AutoCAD Visual LISP / AutoLISP :: Constructing Infinite Lines By Selecting Objects?
Aug 12, 2013Is there way that by selecting objects (Lines,Pl) it construct infinite lines ?
View 3 RepliesIs there way that by selecting objects (Lines,Pl) it construct infinite lines ?
View 3 RepliesHow to modify this routine so that I can select multiple objects as opposed to one at a time?
(Defun c:cd ()
(setq newdim (entsel "
Select Dimension to clear:"))
(setq newdimvalue " ")
(command "dimedit" "n" newdimvalue newdim "")
(princ)
)
I have this code that I wrote years ago that I want to update to select two types of civil3d objects and show them selected with grips on the screen. This function works fine
(defun CELFEATURE ()
(ssget "_X" '((0 . "AECC_FEATURE_LINE")))
(setq sset (ssget "P"))
(if sset
(progn
(sssetfirst sset sset)
;(command "_.PROPERTIES")
)
)
)
(defun cF () (CELFEATURE))
but if I add the extra object like this which I assume is the wrong syntax i only get the second type of objects. Need correct syntax I should be using for selecting more than one object in an ssget statement.
(defun CELFEATURE ()
(ssget "_X" '((0 . "AECC_FEATURE_LINE","AECC_AUTO_CORRIDOR_FEATURE_LINE")))
(setq sset (ssget "P"))
(if sset
(progn
(sssetfirst sset sset)
;(command "_.PROPERTIES")
)
)
)
(defun cF () (CELFEATURE))
I am just starting learning lisp, And I am looking for a fast way to select multiple objects (usually circle) and export their coordinates and ID into a excel sheet through lisp programming.
As you might see in the attached drawing, the red circles are objects wanted. I have been trying to export their coordinates as well as their IDs in grids, e.g D28, Easting: Northing: . I still haven't found a good way to export ID for each circle.
As my code doesn't work, I wonder what's the most effective way to detect errors in lisp
What a lisp routine would look like for selecting all items on layer 5.
View 4 Replies View RelatedThe title says it all, Im trying to find a way to select just the vertical dimensions. Quick select doesn't work because there's no difference between a vertical and a horizontal dimension, so i was wondering if there was a LISP or something else i could do to accomplish this.
View 5 Replies View RelatedI am still green at lisp creation. I would like to create a lisp to change my cannoscale to match that of an existing dimension in model space. we use tabs and therefore have many different scales for the vports in our drawings. i want to be able to type my command, have acad ask for a annotative dimension to match, i click it, then the lisp resets my cannoscale to match.
View 4 Replies View RelatedA code that scans all through the drawing and selects the texts of the same value regardless of the layer, color, style, ...etc..
Just selecting duplicates for highlighting nothing more.
I wrote this small program to automate plotting a drawing to pdf. Everything work fine except I cannot figure out how to allow it to let me pick where I want the file created and what I want to call it. In this routine, the "" at the 3rd from the end place will just automatically name the file and put it in the parent folder. If I replace the "" with pause, it lets me change the name, but will not let me choose the location.
What I'm looking for is for a dialogue box to pop up (explorer style) that will let me choose a location and name the file. This is what happens if you do it "long hand" inside ACAD, how to do it in the code.
(defun C:clpdf ()
(setvar "cmdecho" 0)
(setvar "osmode" 0)
[Code]....
I used to have a lisp routine that would allow me to pick one dynamic block and it would select all instances including the blocks that have become anonymous.
View 5 Replies View RelatedI'm trying to complete the code to select a p-line on layer G-POLY-GSF w/o asking for input. this (setq ent (ssget "X" (list (cons 8 "G-POLY-GSF"))) dosen't seem to work. What I'm I missing here?
(defun cf8 (/ ent dist obj)
(vl-load-com)
(setq ent (car (entsel "
Select line to offset: "))
;(setq ent (ssget "X" (list (cons 8 "G-POLY-GSF")))
[Code]....
With all of you fine teachers, I have the know-how to get the start and end values of a line.
Do you think there is a way to get a point returned that represents the true intersection of the two lines, without having to involke a user defined "getpoint" function using "intersect" osnap?
I want to construct lines between every two line ending point by multi selectio window instead of drawing it manually between lines ending point ?
View 3 Replies View RelatedUltimately I want to delete a bunch of Layers by selecting them using a portion of their name. Is there anything in cad that allows you to specifically select layers using only a portion of the layer name?
Based on AutoCAD Layer Standards: Users label layers with a code; for example: A-ANNO-TEXT
A - Stands for the Architectural Category the layer falls into
ANNO - Stands for Annotation
TEXT - Type of Annotation
I want to use the Layer Delete (-LAYDEL) command to delete all layers that begin with A-ANNO. In the Layer Manager (-LAYER) I am able to select specific layers using a " * " placed before and/or after " A-ANNO " to include all layers with that in its name.
When I write a script however (-LAYDEL); cad will ask me for the layer name, but will not allow me to use the *A-ANNO* to include all layers with that name: A-ANNO-TEXT, A-ANNO-GLAZ, A-ANNO-WALL, etc...
Is there anything in cad that allows you to specifically select layers using only a portion of the layer name??? I have to "taylor" drawings that I receive from companies who's layers may vary.
My script is in basic (NON LISP) language:
-LAYDEL
N
A-GENM
N
A-DOOR
N
A-DOOR-FRAM
N
A-DOOR-GLAZ
N
Y
How can I get the layer that an entity is on. I have tried numerous method but they don't seen to be retrieving the layer information.
View 8 Replies View RelatedI am trying to draw a line between two lines and I put together the following. It works great if the start/end points are perpendicular to each other. How do I solve if line one start point is in a positive direction and line two is in a negative direction?
(defun c:test ()
(setq L1 (car (entsel "
Select the first line: "))
L2 (car (entsel "
Select the second line: "))
)
[code]....
i know DIMANGULAR command will let me draw a dimension to display the angle between two lines, but is there a way for my commandbar to show me what the angle is rather than draw a dimension?
I often want to simply know the angle but not display it in the drawing, and it'd be good if there was a command/lisp which showed me in the command line area, or perhaps a pop up window, similar to what the TLEN lisp does here: URL....
I want to get the minimum and maximum x, y coordinate values of selected lines. In other words, i want to find the top, bottom, left and right edges of a set of lines.
Is it possible to achieve this with a lisp code?
how to delete all OLE objects from drawing by most efficient way.
There are abt 150 drawings, each has from 2 to 20 or so OLE objects which need to be deleted. OLE objects are on many paper spaces.
I tried to use qselect but it selects only what is in current space.
Would need some lisp or some other methode than all can be deleted (excluding those which resides in blocks).
Tried also yto use ssx and then erase but still it deletes only what is on current space.
Just as additional info, those OLE are all pictures, not xls files for example.
I am trying to add a reactor, where if the object i move or copy is s a block of a certain name, then i would like to run update field on the last object (being copied) or the object being moved.
View 4 Replies View RelatedThe below adds a hyperlink to the selected object.How might it have to change to add multiple hyperlinks?
(entmod
(append (entget (car (entsel)))
(list
(list -3
(cons "PE_URL"
(list
(cons 1000 "..\..\90 Submittals\90-3 O&Ms\fig83-clevishanger.pdf") ; Relative Path to a pdf file.
(cons 1002 "{")
[code]...
I have been searching for some information on how to pass objects into a function so I can mess with their properties. Somehow I haven't been very successful. Anyway...What I want to do is take two items (light fixtures) and swap their positions on the drawing. It seems like it must be really simple, but I'm just not finding the key puzzle pieces to do it. It seems like if I could figure out how to pull two objects into the function (whether by selecting them and running the function or by selecting them after I run the function) I could very easily save the coordinates of one to variables and then just swap them.
View 9 Replies View RelatedHow to export to a txt file a list containg all the objects on the current layer and their properties?
To be precise, I would like to export the following items from a selection of plines:
- ObjectID;
- Start Point;
- End Point;
- Vertex Points;
- Width.
with a function like this I added some xdata, some MULTILEADER
(defun c:add_xdata () (princ "Select: ") (setq ogg (car (entsel))) (addXdata ogg "TEST" "CODICE" "1256") (addXdata ogg "TEST" "MATERIALE" "LEGNO") (addXdata ogg "TEST" "TIPO" "A"))
Now with the following function can only select leaders who have linked the xdata application TEST
(setq selez_all (ssget "X" '((0 . "MULTILEADER")(-3 ("TEST")))))
I can not, however, find a way to select all MULTILEADER who have a particular value of XData.
For example I would select all MULTILEADER with MATERIALE = "LEGNO" and TIPO = "A".
I have a lisp I use to calculate the area of an object. The section below is the area part of it:
(setq ojt (entsel "Select object to get area of... "))
(command "area" "o" ojt)
(setq oarea (getvar "area"))
I want to modify it to add the areas of multiple objects. Unfortunately it is not as simple as;
(setq ojt (ssget "Select object to get area of... "))
(command "area" "a" "o" ojt)
(setq oarea (getvar "area"))
So how would I go about doing it?
is it possible select all ANNOTATIVE objects in a DWG and to set a Viewport/ANNO scale for all via lisp
View 3 Replies View RelatedI have made a lisp routine to draw lines on polyline. And here are a lot of lines on it. So using comand
"(command "line" pt1 pt2 " ")"
takes a lot of time. Is here a way to creat lines in memory or similar and only then draw them all on screen?
I have search but coudin't find any info. I do not know how to formulate a query.
I want to move a large 3D steel file on top of a 2D architectural background. The ISSUE is that when i move it (in plan view "aka top view") the X,Y coordinates change AND the Z coordinate changes... But, I want the Z coordinate to stay the same . I wrote a LISP file that doesnt seem to work (SEE BELOW):
(defun C:MoveXY (/ PT1 PTB PT2)(setvar "CMDECHO" 0)(setq PT1 (getpoint "
Specify Base Point or [Displacement] Displacement: ")PTB (getpoint "
Specify second point or <use first point as displacement>: ")PT2 (list (car PTB)(cadr PTB)(cddr PT1)))(command "_.MOVE" (SSGET) "" PT1 PT2))
It seems my issue comes when i get to the command line (ssget) seems to mess it all up . How to use the ".Move" command with the (ssget) function?
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)
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) (...))
Project involves repeatedly mirroring a line by selecting mutiple lines to do the mirroring. Probably sounds confusing.
The progress so far can be found here: [URL] ........