AutoCAD Visual LISP / AutoLISP :: Detect If There Are Objects Selected
Oct 18, 2012
Any way to detect of there are objects currently selected using Autolisp, visual lisp or even VBA. I would like to be able to do something using that as a conditional, so that (assuming the hypothetical variable isSelected is an on/off indicator of whether or not something is selected) I can code something like this:
(if (isSelected) (...))
View 4 Replies
ADVERTISEMENT
Jan 1, 2014
I need a LISP that create a new layer and ask me for the name and the other properties (color,lw,lt..).
ask me if I want move the selected object for the new layer (yes is the default value)
View 9 Replies
View Related
Nov 23, 2012
I need a program to move some selected text to a line something like as extend command but for text objects!
suppose that there is a horizental line (y=constant) or vertical line (x=constant) and some selected text(or other objects), I want a lisp program that move these selected text (or objects) by their "insertion point" to this line.
in other word, if the selected base line is horizental (y=constant) then property of "Y" of all selected text should change to line's "Y"; and if selected base line is vertical (x=constant) then value of "X" of all selected text should match to line's "X" value.
for example, for base vertical line (x=constant) and 3 selected text(or can be any object) result is:
text1. | text1.|
text2. | ===> text2.|
text3. | text3.|
| .text1 |.text1
| .text2 ===> |.text2
| .text3 |.text3
View 9 Replies
View Related
Feb 27, 2013
How can I draw a The smallest rectangle enclosing for a selected set of objects in current drawing?
View 9 Replies
View Related
Jun 13, 2013
I am looking for a way to extract (filter) all polylines, and loop a lisp based on the number that are found within a "W" selection window.I am frustrated getting "malformed list" or errors, even after defining "n" for repeat.The code I have so far looks like this:
(defun cWW (/ p1 p2 sspw myObj ss)
(setq p1 (getpoint "
Pick first corner: "))
(setq p2 (getcorner p1 "
Specify opposite corner: "))
(if
(setq sspw (ssget "W" p1 p2 '((0 . "*POLYLINE")))
[code].....
Without the (repeat () portion, it was working ok with selection window, however it only would run the commands for a single polyline. What needs to be done without overhauling the code? The lisp has worked on a drawing-wide basis, however needs to run on only on user-windowed polylines since there are other polylines within the drawing which are attached to layouts via viewports.
View 9 Replies
View Related
Nov 27, 2012
I want to code this lisp. The problem which I face is, In some drawings which come from the client, there are a lot of blocks.
I want to detect the blocks which has no sub-entities (but attribute) and add a rectangle inside this block, If it is an attribute add a line from 0,0, to insertpoint of attribute.
View 5 Replies
View Related
May 17, 2013
How do you detect the intersection of a line and circle or arc.
View 1 Replies
View Related
May 17, 2012
I need ot append events when the dimstyle is change using the AutoCAD dimstyle popup list, but don't know which reactoer to use. I tried with Comman begin and end, and Sysvawill change and changed, but they don't detect the dimstyle changes.
View 2 Replies
View Related
Nov 8, 2011
I'm putting together a simple lisp routine to issue bound, purged drawings.
I have code that will do the binding & purging but need handling the saving.
This is my approach :
(1) ask the user to save the drawing using this line (command "_saveas" "" "~")
(2) run a subroutine that binds xrefs etc (this works ok)
(3) run the QSAVE command
Trouble is, if the user cancels or hits escape during the SAVEAS command the subroutine & QSAVE will still run, overwriting the current drawing. How do I handle this scenario? Or should my appoach be different?
View 9 Replies
View Related
Nov 14, 2012
I need a LISP program that prompts: "select text(s)" then I select for example 100 text in open drawing file.
after that this program creat a file (LIST.CSV) and write each selected text in line by line of this file:
result text file (LIST.CSV ) should be:
Text1
Text2
Text3
...
...
Text99
Text100
ofcourse Text1 is the content of a text object.
View 9 Replies
View Related
Nov 13, 2012
I’m trying to put together a loop for if nil or something other than text or mtext is accidentally selected than prompt text was not selected. This is what I have so far.
text or mtext is not selected than prompt
(defun C:ww ()
(while
(not
(and
(setq esel (entsel "
[Code]......
View 7 Replies
View Related
Jan 17, 2013
I have a little routine to add two selected numerical texts together and show the result at a selected position. I am using the entsel method to select them. I would like a way to highlight the selected text temporarily. Is this possible. The routine is as follows.
(defun c:T+ ( / Txt1 Txt2 Txt3 Pkt )
;Adds second selected number to first
(setvar "dimzin" 3)
(setq curlay (getvar "clayer"))
(setq curcol (getvar "cecolor"))
(setq curlin (getvar "celtype"))
(setq ds (getvar "dimscale"))
[code]....
View 3 Replies
View Related
Nov 30, 2012
i have found the following lisp in a previous thread: (shows XY coordinates of the selected blocks)
(defun C:MyFunc (/ ss Index Ename Lst)
(while (or (not ss) (= 0 (sslength ss))) (setq ss (ssget '((0 .
"INSERT")))))
(if ss
[Code]....
I want this information to be added to the blocks as hidden attributes so that i can extract them by attout. The work to be done is : attout to excel, autofill an attribute (numbering) then attin.
but my problem is that i cant think of a way to number those blocks IN ORDER (ie top to bottom or left to right) unless by sorting them in excel first by their x or y coordinates
View 9 Replies
View Related
Jan 24, 2013
I need a LISP program to add a text given by user to all selected text.
in other words:
1- user selects some texts.
2- user give a text to program.
3- Program added this text to all selected text.
selected text: text1, text2, text3,text4,....,textn
given text by user: _xyz
Result:
text1_xyz, text2_xyz, text3_xyz,text4_xyz,....,textn_xyz
View 6 Replies
View Related
Apr 1, 2012
I need to convert a lot of different hatches to solid hatches.
I haven´t found a way to do it in Autocad 2012.
script that cycles to all selected hatches and change the properties to solid?
View 4 Replies
View Related
Jun 2, 2004
lisp routine that will add together the values of text entities? For instance, if I have a big parking lot and each section is labeled with the number of spaces, I could pick the texts and it would add all the numbers together to give me a total. Right now I export to excel to do this. I have quite a few situations where this would be handy, not just for parking spaces, so I really just want a lisp that will add all my selected numbers.
View 9 Replies
View Related
Aug 7, 2013
Using Nentsel function, I can get info on a object that is nested with an Xref. Is there a way to move the selected object using ObjectDBX?
View 9 Replies
View Related
Jan 25, 2013
I wish to have a lisp than enable to do automatic offset base on some selection of lines ,circles or polylines object as shown in attachment.
View 9 Replies
View Related
Jun 3, 2013
How to make a lisp command that will select all objects in the drawing?
View 3 Replies
View Related
Sep 9, 2011
I thought this would be a simple tblsearch process, but as far as I can tell, there isn't a tblsearch symbol table for vplayer settings, so I need to get more creative I guess.
I want to be able to get the vplayer color of a selected object as part of a larger routine I'm putting together.
View 8 Replies
View Related
Jun 12, 2013
I found a lisp for counting of selected block in a table drawing, but I can not remove the bottom line of this lisp that displays "total" blocks. How to remove this line from "total" that is created in the last row of the table that lisp.
lisp : ========================================
(defun c:TABL (/ blk_id blk_len blk_name blks ent h header_lsp height i j TOTAL
len0 lst_blk msp pt row ss str tblobj width width1 width2 x y
)
[Code]....
View 4 Replies
View Related
Feb 2, 2013
I need a program to trim selected text(s) with a divisor.
suppose that the divisor character is: "/"
(selected text==>result
textL/textR ==> textR
xxx/yyy ==>yyy
t12x/5678 ==>5678
I should use some commands like:
;;;;div="/":
(setq str "xxx/yyy")
(setq pos (vl-string-position (ascii "/") str))
(setq len (strlen str))
(setq RGT (substr str (+ pos 2) (-(- len pos)1))) ;;=text after "/"
but I need a LISP program that:
1-ask user to give a divisor char: (Divisor character: </>)
2-ask user to select text(s) but program should filter selected text(s) with divisor (*/* pattern)
(if (null #div#)(setq #div# "/"))
(if (and
(setq #div# if (= (setq tmp (getstring (strcat "
Divisor character: <" #div# "> ") ) ) "" ) #div# tmp ) )
(setq ss (ssget "_:L" (list '(0 . "*TEXT") (cons 1 (strcat "*" #div# "*")))))
)
View 5 Replies
View Related
Aug 15, 2013
I think there is a function that will cause the selected object that is in the XRef to highlight.
View 1 Replies
View Related
Jul 17, 2013
I having real difficulty finding a lisp that will find and replace blocks. There are plenty out there and AutoCAD 2013 and lower has a Find and Replace Blocks. However, the frustrating catch is I can seem to find a routine that will allow me to replace only those blocks that I select with a selection set of my choosing. The built in function replaces all of them and will not let you exclude some. We have PID drawings that we want to replace valves on, but not all valves. We don't want to rename. We don't need to BEDIT the existing block.
1) Pick group of blocks
2) specify a new block that will replace all instances of old block
3) replace inserted block with different block. Leaving others alone.
I'm thinking this should be easy, but my search has failed. The blocks in question are not dynamic or attributed either.
View 3 Replies
View Related
Jul 29, 2013
When i export revit drawing with revit family
the revit family become block in autocad like this
M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45
usually i want to remove the ID and view name to become like this without have to re type because it is tedious
M_Single-Flush - 700 x 2200mm
something like how many letters you want to remove from last to first ?
or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name) -278353-Ground Level _0_45?
View 9 Replies
View Related
Nov 13, 2011
i.e. it would be usefull for separating the top and bottom of a sheet metall or plastic part.
Other cad systems I have seen have a function to do this automatically....
View 9 Replies
View Related
Dec 2, 2010
I need a lisp routine which will delete all the dimensions inside selected block or blocks, including nested blocks inside.
View 9 Replies
View Related
Mar 1, 2012
Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.
Once I determine what the object is I can use an if statement to retrieve the value.
;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))
View 4 Replies
View Related
May 13, 2013
I am trying to write a program to align a block with two selected destination points.
- first the user is prompted to select a lwpolyline of a block entity
- then he is prompted to pick two destination points
I face problem with the sub-routine SegmentPts. It is supposed to return the coordinates of two vertexes on both sides of the picked point on a lwpolyline using entsel. But here in my program, when i am picking a point using entsel on a lwpolyline inside a block entity, it is not returning the two vertexes on both sides of the picked point. In stead, it returns some other points of the selected LWPOLYLINE. Why it is doing so? Where is the problem in my program?
It works fine with my other programs where i pick on a LWPOLYLINE entity. In this particular case, the LWPOLYLINE is inside a Block entity and the program is not returning correct points.
Please check Lisp Program below:
(defun C:alb()
(setq ent1 (entsel "
Pick on one side of LWLINE ofa Block:" ))
(setq ent (nentselp (cadr ent1)))
[code]........
View 9 Replies
View Related
Sep 19, 2012
I am trying to insert a norht block oriented on two selected points with the following
(defun c:North ( / ss )
;Orientate North Symbol
(setq oldos (getvar "osmode"))
(setq blk (vlax-ename->vla-object (car (entsel "
[Code] .......
I am not sure how to (a) erase the selected north block, then (b) make the insert north block in its place bit work.
View 6 Replies
View Related
Mar 11, 2013
You have a dwg with multiple sets of different blocks and a circle you want to place on the insert point of each set blocks.
You select the circle then select one of the blocks in the set and the circle is placed on the insert point of each of the blocks in that set. It would save time from doing it manually and save on mistakes.
View 9 Replies
View Related