Jump to content

Recommended Posts

Posted

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

Posted

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))

Posted

Thanks for your reply. But i dont know what language this is

Posted

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

Posted

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

Posted
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?

Posted

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)
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...