AutoCAD Customization: Visual LISP, AutoLISP and General Customization
Retrieving # of entities in a dynamic block ?
I am modifying stuff in a dynamic block insert entitity. There is no "endblk" entity at the end of these definitions and I need to cycle through every entity within the block definition. When it gets to the last entity, I get an error because you cannot entnext passed the last entity. There are 2 things I could use help with:
1. How to retrieve the # of entities in a block without cycling through it.
Or
2. A quick lesson in the *error* function, I cannot figure out how to implement this. I basically want to to say:
(if (entnext myent)) returns a error, don't abort & continue on.
Is this possible ?
Thanks
Where is the developer documentation in map 2014?
I've just downloaded autocad map 2014, but I can't find the developer documentation. I can find some crap in the general help referencing lisp and vba, but no clearly organized developer documentation. In the previous versions there used to be an acad_devxxx.chm file, that was perfect for the job, but I can't find anything similar here. Do I really need to install an earlier version and copy the file from there?
detect intersection of line and circle
how do you detect the intersection of a line and circle or arc
Multileader Block Attributes
Entity name of MULTILEADER they have 3 (assoc 10 ) the first (10 4.11 7.0 0.0) is end points to the tab by the dimenson the next one (10 3.75 7.0 0.0) is the other end point of the tab and the last one (10 2.75 6.0 0.0) is to where the arrow head is how do you have it get it pick the second and third 10 this will only pick the first one (setq pt1 (cdr (assoc 10 (entget (car ML)))))
turn on/off annotative
Hi Guys,
when a text is selected, in properties palette the Annotative field can be turned on/off - how can i do it programatically?
activex doesn't not have a propertiy for it. i presume it is in xrecords but could not find it.
thanks in advanced
Moshe
help needed
I prepared a simple code to make a char table.
It is very easy, but did not work!!
can anybody tell me what is the problem?
(Defun C:CharMap () (setq cnt 1) (setq r_cnt 0.0) (setq ts 16) ;;16x16=256 char (setq x 0.0 y 0.0 sub_y (- y 0.1)) (repeat ts (repeat ts (command "text" "j" "mc" (list x y) "0.05" "0" (chr cnt)) (command "text" "j" "mc" (list x sub_y) "0.05" "0" (itoa cnt )) (setq x (+ x 0.2)) (setq cnt (1+ cnt)) );repeat (setq x 0 y (- y 0.2)) (setq sub_y (- y 0.1)) );repeat (command "zoom" "e" "zoom" "0.75x") )
Thanks,
Abbas
Overlapping Dimension
Anybody have a suggestion to find overlapping dimensions ?
ie: Have a dimension of 2'-0" with a dimension beside of 3'-0" which is correct
BUT
A too quick drafter would have a dimension of 2'-0" and a dimension beside of 5'-0" beacuse the 2'-0" dimension is on top of the 5'-0" dimension. The 5'-0" dimension would be the overall distance of the 2'-0" + the 3'-0" dimension.
Both of the dimensions are correct but they are on top of each other.
How to set the dimension break size in autolisp
I there any way to set the dimension break size in autolisp
Maximum Number Of Lisp Files Compiled to a single VLX File
I just noticed that I can't put any more than 11 lisp files when trying to make one VLX file.
Does this sound true to anyone?
I wanted to break out all of our lisp commands to their own file, so that it is easier to track down and troubleshoot (I guess that's a matter of opinion).
If this is normal or expected behavior, is there anyother way that i accomplish what i'm trying to do? I want a lot of lisp files, but i only wnat one file for users to load into their start-up suite or what have you.
Thanks
KP
2014 and keyboard context menu key
switching from 2010 win xp to 2014 win 7
i need my specific user interface , and cant replicate it because of this issue :
i used to press context menu key on keybard to make edit menus pop up .
in 2014 even though its same settings (show context menus and time sentive click) i ve lost this ability .
either menus dont appear at all or they are replaced by the small command line context menu
i think this suggest new command line features are messing with right click options
interested in suggestions about any variable i can turn off , or else to go back to normal
how can i change radius value in duct lisp
block rename to attribute text value
hi
i wanna change my block name to attribute text value , somebody has a similar lisp code?
Flip Color from bylayer to color and back
I am trying to flip between Bylayer and color 150. If cecolor is bylayer set cecolor to 150 and if cecolor is 150 set cecolor to bylayer. It seems so simple but it's not working.
(defun c:22 ()
(setq cc (getvar "cecolor"))
(cond
((= cc "Bylayer") (setvar "cecolor" "150") )
((/= cc "Bylayer") (setvar "cecolor" "Bylayer") )
)
)
substituting attributes
This is more of a training exercise for me. I hope to someday use it but for now could someone help with with the following:
I isolated 3 attributes as you can see with my code. My object is too take the value of blkDESC1 and set it as blktag, and then take blkDESC2 and set it as blkDESC1, and erase blkDESC2. Any ideas?
(defun c:aup (/ dxf ent dxf1 ent1) (defun dxf (code ent) (cdr (assoc code (entget ent))))
(progn (if (and (setq ent (car (entsel "\nSelect an Attributed Block: ")))
(eq "INSERT" (dxf 0 ent))
(= 1 (dxf 66 ent)))
(while (not (eq "TAG1" (dxf 2 (setq ent (entnext ent))))) ) )
(setq blktag (dxf 1 ent))
(princ "\n")
(princ blktag)
(princ)
(while (not (eq "DESC1" (dxf 2 (setq ent (entnext ent))))) )
(setq blkDESC1 (dxf 1 ent))
(princ "\n")
(princ blkDESC1)
(princ)
(while (not (eq "DESC2" (dxf 2 (setq ent (entnext ent))))) )
(setq blkDESC2 (dxf 1 ent))
(princ "\n")
(princ blkDESC2)
(princ)
)
math in the foreach function
in the foreach function can you use math like (foreach pt1 (add 1) so that foreach one you pick it adds one the next one will be named pt2 then pt3 and so on
Return name of different folders
Hello all,
The following gives me the first folder string, with no back-slashes, that the drawing exists in.
(setq FirstFolder
((lambda (/ tmpDir tmpPos)
(substr
(setq tmpDir (getvar "dwgprefix"))
(+ 2 (setq tmpPos (vl-string-search "\\" tmpDir)))
(- (vl-string-search "\\" tmpDir (1+ tmpPos)) (1+ tmpPos))))))
Is there a way to find the name of the second folder?
Is there a way to find the name of the third folder?
The string length of the characters for each of the first, second, third (and so on) folders are different, which means I can't count character using the "substr" function.
Thanks
KP
Lisp Routine Help
unlocking dxf codes
I am trying to change a viewport scale through the dxf code: I see that certain parts cannot be changed but I don't know if this is one of them. Here's what I have so far:
(defun c:vps ()
(setq quickview (entget(car(entsel))))
(setq g45 (cdr(assoc 45 quickview)))
(setq g41 (cdr(assoc 41 quickview)))
(setq new1 (* g45 1.5))
(entmod (subst (cons 41 new1) (assoc 41 quickview) quickview))
)
The scale is a ratio between m-space height & p-space height. So if I want all viewports to be 1:1.5 scale this is what I need to do, but my entmod command isn't working is there another way?
Finding and replacing "very" special characters
Is there a way to find and/or replace "very" special characters like [carriage return], [backspace] or even [tab mark], considering that the first thing that comes to mind when saying special characters is the standard and extended ASCII only.
Thanks,
I want to Make a Custom Toolbar Control
Hi, Greetings from mexico (I apologize for my bad English)
Can anybody tell me if can i develop a "Custom Toolbar Control" to Display or Set Entity's Elevation,
and place it in the Properties toolbar.
I have the ability to program in AutoLISP language, Diesel and customization with MNL and DCL files.
So, do I need more knowledge?...Or is it simply impossible?.
I thank you in advance for the attention to my post.
