Dec Posted May 5, 2010 Posted May 5, 2010 I have a dxf file which has several lines connected together. The department in the company that I work for need all the lines to become a closed polyline. I have found a VBA macro on this site http://www.cadtutor.net/forum/showthread.php?t=46531 which I have tweaked but I cannot get the lines to become a polyline. I am using DWG editor wich comes with solidworks. The syntax is pretty much identical to autoCAD. I have posted all this on the solidworks site and nobody has replied yet. Please can anyone help me. DXF_Worktop_12345_Top_B.dxf Quote
Lee Mac Posted May 5, 2010 Posted May 5, 2010 Perhaps something simple like this? (defun c:jp (/ *error* vars old ss) ;; Lee Mac ~ 11.04.10 (defun *error* (msg) (mapcar (function setvar) vars old) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq vars '("CMDECHO" "PEDITACCEPT") old (mapcar (function getvar) vars)) (mapcar (function setvar) vars '(0 1)) (if (setq ss (ssget "_:L" '((0 . "ARC,LINE,LWPOLYLINE")))) (command "_.pedit" "_M" ss "" "_J" "" "")) (mapcar (function setvar) vars old) (princ)) Quote
Dec Posted May 5, 2010 Author Posted May 5, 2010 Thanks for your reply. But i dont know what language this is Quote
Lee Mac Posted May 5, 2010 Posted May 5, 2010 This is LISP. Arghh... I see you are using LT - you won't be able to run LISP in LT without an extender... Quote
Dec Posted May 5, 2010 Author Posted May 5, 2010 I am also using DWG editor wich comes with SolidWorks. I have read somewhere that it can load LISP routines. I have just copied your code into notepad and gave it .lsp file extension. I ran the routine from the command line and nothing happened. Cheers. If you know any VBA that would be helpful Quote
Dec Posted May 12, 2010 Author Posted May 12, 2010 I have sorted it. I used a script that that used commands to capture all the entities in the drawing and convert them into polylines Quote
crushmaster Posted May 12, 2010 Posted May 12, 2010 I have sorted it. I used a script that that used commands to capture all the entities in the drawing and convert them into polylines like move entities from layer1 to layer2,it is possible to select all lines,arcs,and so on and make them into polylines?have i misunderstood? Quote
alanjt Posted May 12, 2010 Posted May 12, 2010 Quickie, but I like it... (defun c:MJL (/ ent ss) ;; Join all on selected object's layer ;; Alan J. Thompson, 05.12.10 (and (setq ent (car (entsel "\nSelect object on desired layer: "))) (setq ss (ssget "_X" (list '(0 . "ARC,LINE,LWPOLYLINE") (cons 410 (getvar 'ctab)) (assoc 8 (entget ent)) ) ) ) (if (eq (getvar 'peditaccept) 1) (vl-cmdf "_.pedit" "_m" ss "" "_J" "" "") (vl-cmdf "_.pedit" "_m" ss "" "_Y" "_J" "" "") ) ) (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.