AutoCAD Visual LISP / AutoLISP :: Pline Dimensioning
Sep 2, 2005I am looking for an AutoLISP routine, which gives all aligned dimensions of a closed polyline, drawn in 3d.
I have attached a 2D drawing for reference.
I am looking for an AutoLISP routine, which gives all aligned dimensions of a closed polyline, drawn in 3d.
I have attached a 2D drawing for reference.
I have LWPOLYLINEs that represent a cross section of a train tunnel. Each LWPOLYLINE lists its 2D points in an Object Coordinate System.My task is to create 3D Polylines in WorldCoordinateSystem using those LWPOLYLINEs.I have posted a drawing with sample objects.
I have attached a sample drawing. Drawing was created with Civil 3D 2013, but I exporttoautocadr12dxf'd it and then save to 2004 dwg so most should be able to open it.
Is there anyway to use LISP to list the x,y coordinates of a pline?
View 3 Replies View RelatedIn continuation with thread All to Pline . I want to add one more function to this lisp i.e. Join all the objects selected.
Can this be done?
I tried this:
(command "_.pedit" "m" ename "" "j" ename "")or (command "_.pedit" "" "j" ename "" "")
But it gives me an error something like this:
Requires numeric distance, two points, or option keyword.
; error: Function cancelled
Enter fuzz distance or [Jointype] <0.000>: j
Enter join type [Extend/Add/Both] <Extend>: *Cancel*
or
Command: ch2pl
Select objects: Specify opposite corner: 5 found
Select objects:
*Invalid selection*
Expects a point or
Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Multiple]:
; error: Function cancelled
Select polyline or [Multiple]:
Enter an option [Close/Join/Width/Edit vertex/Fit/Spline/Decurve/Ltype
gen/Reverse/Undo]: *Cancel*
Command: Specify opposite corner:
Command: *Cancel*
Is there a function to obtain the start angle and end angle of a pline, i know arcs do.
View 4 Replies View RelatedI have this code to make fillet to a polyline, but the command does not allow specify fillet radius. How I can change the routine?
(defun C:filletv ( / ent ) (setvar "FILLETRAD" 2.500) (if (setq ent (entsel "
Select element near vertex: ")) (command "_fillet" "_P" ent) ) (princ) )
I have been using one routine very successfully to create a pline in modelspace that has the outline of the chosen viewports in the drawing. This one works great.
Now I am trying add other routines that I've done to better fit my needs. If I use each routine individually at the command line they work, but when I use all in a single command I got the following errors:
The routine SetColor - does not change color to Bylayer The routine RectWidth - ; error: bad SSGET list
Why?
See the attached file for more details and be free to improve whatever you want in my routines because they are very basic.
And, if I am not asking to much, is that possible to not be prompt to select objects? I mean, the routine could automatically select all viewports in the drawing...
I have plines of circuits that sometimes have T's (line goes along, then T's out then back to T point and then continues).
Here is example line -
(setq List_Pline (list (list 0 0) (list 1 1) (list 0.5 1.5) (list 1 1) (list 2 2) (list 3 3) (list 3.5 2.5) (list 3 3) (list 4 4)))
nth 0 = (0 0)
nth 1 = (1 1) - T point
nth 2 = (0.5 1.5)
nth 3 = (1 1) - T return point
nth 4 = (2 2)
nth 5 = (3 3) - T point
nth 6 = (3.5 2.5)
nth 7 = (3 3) - T return point
nth 8 = (4 4)
I need to be able to pick 2 points along the line and find the shortest route.
Examples -
1st point at 1,1 and 2nd point at 3,3 - new line is nth's 3,4,5
1st point at 0,0 and 2nd point at 1,1 - new line is nth's 0,1
1st point at 2,2 and 2nd point at 3,3 - new line is nth's 4,5
1st point at 3,3 and 2nd point at 4,4 - new line is nth's 7,8
1st point at 0,0 and 2nd point at 3,3 - new line is nth's 0,1,2,3,4,5
1st point is 1,1 and 2nd point is 1,1 - new line is nth's 1,2,3
I've tried using vlax-curve-getParamAtPoint, but it returns 1st T point.
Synopsis of program -
Select Pline
Pick 1st point
check if on line
Pick 2nd point
check if on line
check if 2nd point is before 1st point, if so swap locations
find last nth of 1st point
find 1st nth of 2nd point
return list
I have been having a few 3dpline's with the last vertex being in a different layer. I saw a site mention that this is an AutoCAD 14 bug that could be caused if a program does not end the pline with the layer being set properly before doing a seqend command. If I move the entity to another layer and then back to the correct one it will fix it. Audit in R14 will not show any errors. If I export the file to AutoCAD 12 , audit will detect and fix the problem. I would like to find a Lisp, ARX, etc. that would check for this problem and fix, change color or layer, or whatever.
View 2 Replies View RelatedNow I have all block instances rounded into a 5mm-accuracy. How to also round in Line start and end points (and maybe even polyline vertices) into a 1mm (or custom) accuracy. There are hundreds of inaccurate line elements within the drawing .
View 4 Replies View RelatedHow to change the ltype in a PLINE drawn whith this
(defun c:cordaluminosa ()(if (tblsearch "LAYER" "Elétrico - Luminotécnico")(command "_.-layer" "_THAW" "Elétrico - Luminotécnico" "_ON" "Elétrico - Luminotécnico" "_SET" "Elétrico - Luminotécnico""")(command "_.-layer" "_MAKE" "Elétrico - Luminotécnico" "_COLOR" 3 "" ""))(command "._pline")(while (wcmatch (getvar "cmdnames") "*PLINE*")(command pause)))
I want to set the ltype FENCELINE1 to this object.
what I am attempting -
Pick a line
Pick a starting point on the line
Pick a ending point on the line
Pick side to offset
create list of offset points
Create a new line with a offset
I think I could do this using brute force, but would prefer a mathematical solution.
the resulting arc-fit pline has each pline segment converted into two arcs, the common radii of which are perpendicular to the original segment (unless direction of curverature changes)
the resulting arcs can be calculated given the angle of the tangents for each segment.
the factors for determining the tangents at vertex N are:
deflection angle at N
deflection angle at N+1 (90° or non-extant = not a factor, 0° or 180° = segment is the tangent)
deflection angle at N-1 (90° or non-extant = not a factor, 0° or 180° = segment is the tangent)
ratio of lengths of segments (N , N+1) and (N , N-1)
I can find the tangents when N±1 = 90° and when the segment lengths are equal but i can't figure out how to compute the tangent if these 3 factors are varied.
I don't want to use (command"._PEDIT" pl "_FIT""") because i need to collect the arc data anyway and at a high frame rate. The data will be used to further compute a spline frame that best fits a quadratic spline to the arcs. That part i know how to do!
I have a program that makes 3d polylines from various data. That 3d pline then gets added to a civil 3d surface as a breakline. I want to modify the pline with my program, but preserve the handle, as I think that is what C3D uses to decide if its part of the surface. I tried this as a sample with no luck:
;DELETE 3RD VERTEXT FROM 3D PLINE
(DEFUN C:T3 ( / EN ENAME ENT ENTL)
;GET 3D PLINE
(SETQ ENT (ENTSEL "
Select 3D Pline:")
[Code] .....
I know you can modify a vertex, but what about add and delete with entmake and entmod? I also considered using activex for this task, but you can only add verticies from what I could tell in the object browser of VBA, not delete them.
What I will be doing is deleting all the verticies and adding back the correct ones. Or if there was a way to transfer a handle to a new entity after deleting the old, that would suffice too.
I need to change the color of all lines/plines that intersect a given pline. How would I go about making the selection set of all lines that intersect that given pline.
View 8 Replies View RelatedThere are a ton of lisp to match text rotation to a selected line, but not vice versa.
View 9 Replies View RelatedIs there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high? If there is no lisp already created, how to create one?
See Continuous dimension attachment for example.
I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.
I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg"). how would i go about doing that using LISP?
View 2 Replies View RelatedIs there a way to programatically set a visual style before a drawing actually opens?
We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings. Some models will crash on some workstations when trying to open in a rendered mode.
I found a lisp with a function that looked to set viewport visual styles. But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)
I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.
attached is what I have written so far:-
Lisp that switches back on Selection Preview i.e. thickens and highlights lines when you hover over them?I don't know why, but they are always unticking the boxes.
View 4 Replies View RelatedIs it possible to execute a certain command based on multiple selections withinin a dcl? for example: two radio colums, one with selections A and B, and a second with selections 1 and 2. is it possible to program commands based on user selections from each column? ex: if A and 1- do a command. A 2- do a different command, etc...
I tried :
(action_tile "key1" "(setq A t")
(action_tile "key2" "(setq B t")
(action_tile "key3" "(setq 1 t)(done_dialog)")
(action_tile "key4" "(setq 2 t)(done_dialog)")
(if
(and (a) (1)
)
(command ...
but was unsuccessful. no matter which combination was selected, the command under all combinations would run.
I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.
View 9 Replies View RelatedI have a routine that work fine, but I receive a nil at the end of command. How to fix that?
View 7 Replies View RelatedI'm trying to find acceptable point values to feed to the vlax-3d-point function for a vla-addmtext function. With vanilla lisp I just provide the point as x y = "7/32" "2-3/8". So I assumed that I could drop a 0 in for the z like: (VLAX-3D-POINT "7/32" "2-3/8" 0).
Then I thought I was going to be tricksy and try (vlax-3D-point (getpoint)) believing that I could pick the point and get what I need to feed the function, but yet again, no deal. The command line gave me:
node
of #<variant 8197 ...>
Nothing I can use in my code. So how do I find the point in a format that vlax-3d-point will like?
What is the magic word for put a point at each end of an arc, the lisp I have only put a point at center of the arc.
(defun cAA ( / i j ss e1 e2 p1 p2 p3 points )
(if (setq i -1 ss (ssget '((0 . "ARC"))))
(progn
[Code].....
Is there a quick way of getting the value of an attribute?
I have an attributed block called "tp_attributes" and it has and attribute called "OrderNum".
I just want to be able to quickly grab that value.
I use Spell Check regularly and I always check the entire drawing. I would like to add to the Spell macro so that when I pick Spell from the toolbar it goes past the Check Spelling window and begins checking the entire drawing.
I believe I need to insert Alt S into my macro to select Start from the window to begin the check. Is there a character or series of characters that will represent Alt in a macro?
I upgraded from Autocad 2004 to 2012 recently and my lisp file doesnt work anymore.
what it's supposed to do is when looking at the layout tab that you want you can switch to the model space location of the same zoom as the layout tab without messing with the layout zoom.
(defun c:msp ()
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command"view" "d" "tmp")
(setvar "tilemode" 0)
(command"pspace")
(princ "Click TWICE on desired VPORT: ")
(command "mspace" pause "view" "s" "tmp")(princ)
(setvar "tilemode" 1)
(command "view" "r" "tmp")
(setvar"cmdecho" cm)
(princ)
)
I need a program that simulate this DOS command: dir /on/b *.dwg >list.txt
it list all dwg files on current open dwg file folder and sort them and finally put them in a text file with list.txt name. something like thistype list.txt)
test1.dwg
test2.dwg
test100.dwg
test256.dwg
test1005.dwg
(sort alphabetically and logically) because of disabled DOS utility in my PC I need a pure lisp functions, I tried to wrote this program but I couldn't!!
(defun c:listMaker()
(vl-load-com)
(setq path (getvar "dwgprefix"))
(setq fn "list.txt")
[code]...
and also I need a append a string(='This Is EOF') in the last line of the "list.txt" file.
I have text objects with the same Z value and I will select as follows:
(setq sstxt (ssget '((0 . "TEXT")(8 . "APS-text"))))
How to store this value in another variable "zvalue" to apply to:
(command "change" "select text objects" "" "_p" "_e" zvalue "") ?