AutoCAD Visual LISP / AutoLISP :: Code To Convert All Lines
Sep 18, 2013
I need a lisp code to convert all Lines, Polylines, Arcs and Splines to Polylines with 0.4 width.
I prepare this:
(defun c:CH2pl ( / SS);changes all lines, plines, arcs and splines to POLYLINE with 0.4 width(if (setq SS (ssget "_X" '((0 . "LINE"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "*POLYLINE"))))(command "_.pedit" "m" SS "" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "ARC"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "SPLINE"))))(command "_.pedit" "m" SS "" "Y" 10 "w" 0.4 "")))
But I want pure lisp code in a professional way!
View 9 Replies
ADVERTISEMENT
Jan 1, 2014
I have this code to draw grid lines within a rectangle:
;Variable settings(defun var_set () (setq *var_lst* '("cmdecho" "osmode" "expert" "plinewid" "dynmode") *var_usr* (mapcar 'getvar *var_lst*)) (mapcar 'setvar *var_lst* '(0 0 2 0 0)) (vl-load-com))(defun var_reset ()(mapcar 'setvar *var_lst* *var_usr*)) (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "" nil)) ) (princ (strcat "
Error: " msg)) ) (and ;(vl-bt) (var_reset) ) (princ) ) (defun string-list (data) ;by lee-mac @theswamp (if (vl-string-search "@" [code].........
The above gets me the grid lines; but I have a block inserted at both ends of the grid line; how do I get the selection of those entities (selection set "frame") after each array?
or I would need to map a point list and draw each grid individually how do I go about that?
Attached is the sample of the output I'd like to achieve using LISP.
View 3 Replies
View Related
Aug 6, 2013
I have lisp code, which count total length, but I need that it count and multiply by constant which I choose manual (such as in example, total lines yellow length * y + total blue lines * x = ... , example 50*2 + 60 * 3=280),
remember the another code, such as I have d200 with total l=1000 and d250 with total l=1500, i need to count total cost such as 1000*y+1500*x
one think, diameters numbers is not only 1 or 2, it can be many different diameters.
dwg file here:
[URL]..........
lisp file here:
[URL]........
View 9 Replies
View Related
Feb 26, 2012
Just going over some old stormwater flows but have some other stuff included in the coordinates I have, is their anyway to convert lines to points?
I know a long way but im just seeing if theres a quick lisp routine that can do it for me?
View 1 Replies
View Related
Feb 10, 2012
I need a function that allows to convert the polylines selected with a width globalize defined in a double closed line (spaced by the same width of the polyline), with a hatch inserted automatically defined.
Brilliant idea to draw raceways quickly: instead of making handmade double lines, connect, enter the hatches all by hand, you could quickly draw the polyline with width identical to the size of the duct, and then the lisp transform it into a duct more aesthetically pleasing if compared to the full polyline!
View 9 Replies
View Related
Jan 24, 2012
I have a project in 3D that I would like to export to Stadd. This requires lines rather than blocks. Is is possible to convert the blocks in the attached dwg file to to lines that are centered on those blocks?
View 9 Replies
View Related
Oct 1, 2013
can more easy convert lisp to visual basic code?
View 1 Replies
View Related
Apr 3, 2013
I know to get the spacial filter on an xref to get the clip verticies, but not how to tell if its an invert xclip.
Even the arx guys seem to have difficulty with this. How to do it with lisp, com, or arx code?
[URL] ......
View 1 Replies
View Related
Aug 20, 2013
Modify the attached lisp I found in this forum to work using a different hatch pattern, scale and angle. The new hatch should be in default Autocad "LINE" pattern and angle set to 90 degrees (vertical). If possible, I would like the angle and scale to be editable. Find attached Multi_Hatch-45 code posted by CADaStroumph in 2008.
View 9 Replies
View Related
Jun 18, 2013
This lsp was passed on to me from a colleague but he doesn't know where he got it. It does a useful procedure of placing each xref, residing in the drawing, to a unique layer. The layer name is derived from the xref name. I would like to edit this to take only part of the xref name. This system I work with requires all files to have the job number as a prefix eg LE1399901_Contours.dwg, so the xref name would be LE1299901_Contours by default. I want to remove the first 10 characters to be left with "X_Xref-Contours" layer name using this code.
(defun dxf (i a) (cdr (assoc i a)))
(defun c:lxr ( / ss cnt xrs en ed bn xp xbn )
(setq ss (ssget "x" '((0 . "INSERT"))))
(setq cnt 0)
[code]........
View 5 Replies
View Related
Feb 19, 2012
LISP code to link to a scr.file.I would like to run ACADDOC.lsp with abobe code everytime I open a drawing.But I want to link the KISP file to script file of mine like C:
View 3 Replies
View Related
Sep 22, 2011
Where I can find the DXFIN command code? I want to examine it to see how it does what it does.
View 2 Replies
View Related
Dec 4, 2012
The code removes prefixes bind ($ 0 $), renaming layers, blocks, dimension styles, but some objects do not change the name as linetypes, text styles and duplicate names.If I have an existing name, I want to change the name with a (2) at the end.Example.
Layer: FloorLevel$0$Door90
If the layer "Door90" is existing, is renamed to "Door90 (2)"
(defun c:delprefixe(/ ActDoc Name NewName)(vl-load-com)(defun RemoveBindPrefix (String / Pos LastPos)(if (setq Pos (vl-string-search "$" String))(progn(setq LastPos Pos)(while (setq Pos (vl-string-search "$" String (1+ Pos)))(setq LastPos Pos))(substr String (+ 2 LastPos)))String));
[code]....
View 3 Replies
View Related
May 20, 2013
hiding the modellayout from code.My code is updating the registery properly.but it is not reflecting/hiding the model/layout tabs in application. hide/trunoff from code.Model/layout is not required for my application.Is there any command to hide model/layout tab.
void CMyApp::TurnoffModelViewLayoutTAB()
{
//TurnOff Model View Tab
[Code]....
View 2 Replies
View Related
May 16, 2012
I have the following code in a toolbar button that when I click on a setup within this tool it imports that setup into my current dwg. How to edit this code so that it will continue to import the setup of choice into the new drawing..but in addition....set the new one current & delete all previous setups that were in the drawing?
^C^Cfiledia;0;^Rpsetupin;"K:/_BARONE TEMPLATE FILE-2012/BARONE_PAGE_SETUPS.dwt";filedia;1
View 9 Replies
View Related
May 2, 2013
I'm trying to check for the existence of a drive using lisp, then if not found perform a task (represented in my below example by the alert)
(if (vl-file-directory-p "C: en") T)(alert "exists"))
I know it doesn't work because if I change the T to nil as demonstrated bellow I should invoke the opposite reaction from autocad but instead I get the exact same outcome which is an alert telling me the file exists?
(if (vl-file-directory-p "C: en") nil)(alert "exists"))
View 7 Replies
View Related
Jul 23, 2013
My code returns the error, but it still works.
(vl-load-com)
(setvar "cmdecho" 0)
(vlax-for ucs (vla-get-UserCoordinateSystems (vla-get-Activedocument (vlax-get-acad-object)))
(setq UCSList (cons (vla-get-Name ucs) UCSList)))
(setq FileName (vl-Filename-Base (getvar "Dwgname")))
(setq NewUCSList (vl-remove-if '(lambda (x) (vl-string-search FileName x)) UCSList))
(setq Listlength (length NewUCSList))
[code]....
View 4 Replies
View Related
Oct 11, 2013
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?
View 9 Replies
View Related
Dec 23, 2011
So I can run the following code from the command line with no problem:
(WRK-Insert_Standards_Block '("S:\AUTOCAD\_Common\Linetypes\CSW_Civil-Linetype"))
(WRK-Insert_Standards_Block '("S:\AUTOCAD\_Common\Linetypes\CSW_Survey-Linetype"))
(WRK-Layer_Insert_all "CSW-X-FM_Layers_List")
However when I put it into a macro (custom command to be used from the ribbon) it spits out the following in my command line:
(WRK-Insert_Standards_Block '("S:
View 2 Replies
View Related
Aug 3, 2013
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 Related
Nov 23, 2011
My work needs to convert thousands of DGN files to DWG. We are using AutoCAD 2012. Is it possible to batch convert dgn files with a LISP and a mapping file?
View 9 Replies
View Related
Jun 6, 2012
I have a list that is "acl", I would like to convert it to a string "acl", everything that I have read uses alot of code. Does this really take that much code to do?
View 9 Replies
View Related
Jan 6, 2005
is there a way to convert multiple 2d solids to hatches.
View 9 Replies
View Related
Aug 1, 2006
What is the Command that Converts a Field to Text so that I can stop a Field updating after the initial set-up? I need to apply this in lisp.
View 9 Replies
View Related
Sep 12, 2013
I have searched the web and the Autodesk Discussion Group for a LISP Routine that allows me to convert all attributes in a drawing to Layer 0 but i have had no luck. It would be great if the LISP could edit xrefs as well although not sure if this is possible.
**BATTMAN command will take too long for the hundreds of blocks, xrefs and drawings i need to edit.
View 2 Replies
View Related
Jan 10, 2012
I wrote code for an application that stores links to lines and blocks in dictionaries using handles. The routines work well and I can manipulate the data marvelously, but if one of the lines or blocks get erased the whole danged opera falls apart. I knew this when I wrote the routines and have always been careful about using the ERASE command, as a matter of fact, I considered disabling it.
I am trying to make the package more robust. I have been experimenting with attaching a reactor (:vlr-erased) to the objects which fires when the object is erased. Unfortunately it fires before I can retrieve the handle of the object so that I can remove the references from the dictionaries. The only thing that I can retrieve once ERASE fires is the ObjectID. I can't seem to find a Visual Lisp routine to convert this value to a handle, does one exist? Is there an ObjectID collection that has any references in it?
View 2 Replies
View Related
Mar 12, 2012
I am trying to shorten my code by using the variable as the command name. Is that possible to do?
;; instead of this(cond ((eq USER_INPUT_ANSWER "blk-cdtree-01-06")(C:blk-cdtree-01-06)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-08")(C:blk-cdtree-01-08)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-10")(C:blk-cdtree-01-10)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-12")(C:blk-cdtree-01-12)));; do something like this(C:blk-cdtree-(substr USER_INPUT_ANSWER 11))
View 8 Replies
View Related
Feb 15, 2013
I 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]....
View 9 Replies
View Related
Nov 28, 2011
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....
View 9 Replies
View Related
Dec 5, 2013
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?
View 9 Replies
View Related
Sep 21, 2004
Code to convert a spline or read its points so I can create a curved leader (with arrowhead) reasonably close ?
View 9 Replies
View Related