Jump to content

Lisp to Select/Picking line/arc/spline to Create Polyline?


Recommended Posts

Posted (edited)

Hi Bro,

 

Am Looking for a Lisp to Select/Picking a Line to create a Poly-line Over the same Line or arc or spline in a "Specified Layer"

 

 

(setq cp (mapcar 'getvar '(cmdecho peditaccept)))

(if (setq ss (ssget "_:L" '((0 . "LINE,SPLINE,ARC"))))

Edited by srinak47
Posted

Try this ...

 

(defun c:2pl (/ cp ss)
 (setq cp (mapcar 'getvar '(cmdecho peditaccept)))
 (if (setq ss (ssget "_:L" '((0 . "LINE,SPLINE,ARC"))))
   (progn (mapcar 'setvar '(cmdecho peditaccept) '(0 1))
          (command "_.pedit" "_m" ss "" "" "")
          (mapcar 'setvar '(cmdecho peditaccept) cp)
   )
 )
 (princ)
)

Posted

The answer is simply the PEDIT command (bulit-in). With the addition that if you want to convert a spline into arcs and not lines made polyline, then look for FLATTEN command (also built-in).

Posted

Thanks for the Quick reply, i think this lisp is converting the original line to a Poly-line,, but i wanted to create a new poly-line over the line or arc or circle or even poly-line ....

Like a duplicate line ofc in a "specified layer" so i can isolate them later...

 

Instead of overdraw on the line am looking to pick and create a new POLY-LINE

 

 

 

Try this ...

 

(defun c:2pl (/ cp ss)
 (setq cp (mapcar 'getvar '(cmdecho peditaccept)))
 (if (setq ss (ssget "_:L" '((0 . "LINE,SPLINE,ARC"))))
   (progn (mapcar 'setvar '(cmdecho peditaccept) '(0 1))
          (command "_.pedit" "_m" ss "" "" "")
          (mapcar 'setvar '(cmdecho peditaccept) cp)
   )
 )
 (princ)
)

Posted

I think this also same as converting the line to poly line.... am looking for creating a new poly line.

Posted

Please set the DELOBJ system variable to 0 to preserve original entities (although seems to works only for splines).

 

Or add this line to above code:

...
   (progn (mapcar 'setvar '(cmdecho peditaccept) '(0 1))
[color=magenta]           (command "_COPY" ss "" '(0.0 0.0) '(0.0 0.0))
[/color]           (command "_.pedit" "_m" ss "" "" "")
          (mapcar 'setvar '(cmdecho peditaccept) cp)
   )
...

Posted (edited)

yeah its working ... but 2 things

 

1.its creating a duplicate pline in the same layer,, i wanted that new pline to create in a specified layer for Eg.. "A_AREA-PL"

2.the new pline wont join together automatically or i have to pedit once after this....?

 

 

But this made my work to half,, thanks a lot man.................. i must owe you a beer :)

Edited by srinak47
errror
Posted

You didn't said above about joining the plines.

...
   (progn (mapcar 'setvar '(cmdecho peditaccept) '(0 1))
[color=magenta]           (command "_COPY" ss "" '(0.0 0.0) '(0.0 0.0))
          (command "_CHPROP" ss "" "LA" "A_AREA-PL" "")
[/color]           (command "_.pedit" "_m" ss "" [color=magenta]"_J" "0.0" ""[/color])
          (mapcar 'setvar '(cmdecho peditaccept) cp)
   )
...

Posted (edited)

So great :):):):):):):):):):):)

 

Last thing..... New P-LINE Draworder to come up..... right now new p-line creates below the line....

Edited by srinak47
Posted

To further cannibalize Tharwat's code:

...
  (progn (mapcar 'setvar '(cmdecho peditaccept) '(0 1))
[color=magenta]          (command "_COPY" ss "" '(0.0 0.0) '(0.0 0.0))[/color]
[color=magenta]          (command "_CHPROP" ss "" "_LA" "A_AREA-PL" "")[/color]
[color=magenta]          (command "_DRAWORDER" ss "" "_F")[/color]
         (command "_.pedit" "_m" ss "" [color=magenta]"_J" "0.0" ""[/color])
         (mapcar 'setvar '(cmdecho peditaccept) cp)
   )
...

Posted (edited)

thanks and also customized what i required

Edited by srinak47

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