AutoCAD Visual LISP / AutoLISP :: Smallest Rectangle Enclosing Selected Set Of Objects
Feb 27, 2013How can I draw a The smallest rectangle enclosing for a selected set of objects in current drawing?
View 9 RepliesHow can I draw a The smallest rectangle enclosing for a selected set of objects in current drawing?
View 9 RepliesI 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)
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) (...))
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
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.
how I would go about writing a function that would calculate the length of a diagonal of a rectangle using SQRT function? I've been trying but so far nothing!
View 4 Replies View RelatedI need lisp that draws rectangle between two lines by window selection. As attached.
View 3 Replies View RelatedWhen i click rectangle i need a text( vertex order ) but some distance form rectangle. Text must be inside the rectangle. but i don't want exact corner co-ordinates.
View 4 Replies View RelatedI found a lisp in the net to create a rectangle by marking objects in a draw.
But it would nice to get at the end of the lisp after creating the rectangle a output in the command line about the length and with of the created rectangle.
who can add the code for the length/width output?
(defun C:wer (/ AUSWAHL INDEX ELEM XYMIN XYMAX MINX MAXX MINY MAXY DATA A) (vl-load-com) (if(and(or (and (setq AUSWAHL (ssget "I")) (> (sslength AUSWAHL) 0)) (and (setq AUSWAHL (ssget)) (> (sslength AUSWAHL) 0)) ) (or(setq A (getreal "
Randabstand <0> : ")) (setq A 0.0) ) ) (progn (setq INDEX -1) (repeat
[code]........
I want to create a custom linetype that uses a solid rectangle 0.5wide and 1.0 long. Basically I want to create a shape file from an existing block I have so that I can insert it into the linetype definition. Is there an easy way to do this in ACAD 2009?
View 8 Replies View RelatedI 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.
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]......
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]....
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
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
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?
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 RelatedUsing 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 RelatedI 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 RelatedHow to make a lisp command that will select all objects in the drawing?
View 3 Replies View Related 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.
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]....
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# "*")))))
)
I think there is a function that will cause the selected object that is in the XRef to highlight.
View 1 Replies View RelatedI 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.
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?
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....
I need a lisp routine which will delete all the dimensions inside selected block or blocks, including nested blocks inside.
View 9 Replies View RelatedIs 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))
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]........
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.