CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedExplode only polyline

 Post Reply Post Reply
Author
marian1autocad View Drop Down
Newbie
Newbie


Joined: 30.Oct.2014
Location: Romania
Using: Autocad2014
Status: Offline
Points: 5
Direct Link To This Post Topic: Explode only polyline
    Posted: 06.Feb.2015 at 19:38
Hi everyoane,

I have a drawing in Autocad that contains lines, text, block reference, mtext and polylines.

In this drawing with Autolisp i want to do next:

1. select all polylines
2. explode them

I made, and i run this in Autocad but it doesn't work:

(setq pl (ssget "X" '((0 . "LWPOLYLINE"))))
(command "explode" pl)

What is wrong in my syntax?

How can i select all polylines from a drawing, and than to explode them?


Any help is appreciated.

Thank you very much!
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 686
Direct Link To This Post Posted: 06.Feb.2015 at 19:54
For some reason I've never seen explained, the Explode command in particular cannot Explode more than one thing at a time in a (command) function.  There are at least two things you can do:  1) Step through the selection set and Explode each one individually, or 2) Mess around with the mysterious and undocumented QAFLAGS System Variable.  If you Search for QAFLAGS in the AutoDesk Customization Forum, http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130, you'll find various threads that talk about it and show you how to change the setting [and be sure to change it back!].
Back to Top
marian1autocad View Drop Down
Newbie
Newbie


Joined: 30.Oct.2014
Location: Romania
Using: Autocad2014
Status: Offline
Points: 5
Direct Link To This Post Posted: 06.Feb.2015 at 21:08
I will search for QAFLAGS in the AutoDesk Customization Forum and i will see what advantage can bring. Big smile

Thank you Kent Cooper for your help and for your time spent here for my probleme! I appreciate.
Back to Top
criecky View Drop Down
Newbie
Newbie


Joined: 02.Jun.2013
Location: Germany
Using: acad 2011 - 2015
Status: Offline
Points: 1
Direct Link To This Post Posted: 08.Feb.2015 at 09:49
hi, use

(defun c:polyexplo (/ pl)
(setq pl (ssget "X" '((0 . "POLYLINE"))))
(command "_explode" pl)
)

Back to Top
marian1autocad View Drop Down
Newbie
Newbie


Joined: 30.Oct.2014
Location: Romania
Using: Autocad2014
Status: Offline
Points: 5
Direct Link To This Post Posted: 08.Feb.2015 at 20:47
Originally posted by criecky criecky wrote:

hi, use

(defun c:polyexplo (/ pl)
(setq pl (ssget "X" '((0 . "POLYLINE"))))
(command "_explode" pl)
)



I tried your proposal and it did not work. Thank you Criecky!

Any suggestion are welcom.
Back to Top
marian1autocad View Drop Down
Newbie
Newbie


Joined: 30.Oct.2014
Location: Romania
Using: Autocad2014
Status: Offline
Points: 5
Direct Link To This Post Posted: 08.Feb.2015 at 21:37
Originally posted by Kent Cooper Kent Cooper wrote:

For some reason I've never seen explained, the Explode command in particular cannot Explode more than one thing at a time in a (command) function.  There are at least two things you can do:  1) Step through the selection set and Explode each one individually, or 2) Mess around with the mysterious and undocumented QAFLAGS System Variable.  If you Search for QAFLAGS in the AutoDesk Customization Forum, http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130, you'll find various threads that talk about it and show you how to change the setting [and be sure to change it back!].



Kent Cooper gave me the solution
for my problem, and i want to thank him very much.

I set QAFLAGS variable to 1 (0 is default value) and after that my syntax works well. Big smile



My syntax now will be:

(setq a (getvar "qaflags"))

(setq b (setvar "qaflags" 1))

(setq pl (ssget "X" '((0 . "LWPOLYLINE"))))

(command "explode" pl "")

(setvar "qaflags" a)



Here ( http://www.manusoft.com/resources/acadexposed/sysvars.html  ) i found this:

QAFLAGS bitcode 0 - 32767* R11 bit 0 (1) : ^C in menu macro cancels grips (acts like keyboard <Esc>).
bit 1 (2) : no pause during text screen listings.
bit 2 (4) : no "alert" dialogs (text display instead).
bit 7 (128) : accepts "screen picks" (point lists) via (command) function.
*Note that this was an integer with range -32768 - 32767 in R11, then it changed to 0 - 32767 in R12.[2]

My problem is now solved and this topic should be closed!

Thank you Kent Cooper for your help!
Big smile
Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2121
Direct Link To This Post Posted: 08.Feb.2015 at 22:25
But this is the official way to do that:
 
(setq pl (ssget "_X" '((0 . "LWPOLYLINE"))))
(initcommandversion 2)
(command "_explode" pl "")
Vladimir Michl (moderator)
ARKANCE - https://arkance.world - Autodesk Platinum Partner
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 686
Direct Link To This Post Posted: 09.Feb.2015 at 15:47
Originally posted by Vladimir Michl Vladimir Michl wrote:

But this is the official way to do that:
.... (initcommandversion 2) ....
 
... if you have a new-enough version of AutoCAD [I'm not sure in which version that was introduced].  Is the 2 there calling for a newer version of Explode that, inside a (command) function, can work with a selection set of more than one object?  If so, that would also require a new-enough version of AutoCAD.


Edited by Kent Cooper - 09.Feb.2015 at 15:52
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 686
Direct Link To This Post Posted: 09.Feb.2015 at 15:51
Originally posted by criecky criecky wrote:

hi, use

(defun c:polyexplo (/ pl)
(setq pl (ssget "X" '((0 . "POLYLINE"))))
(command "_explode" pl)
)

 
The reason that doesn't work is that the only difference from the code in the first Post [other than the (defun) wrapping] is the entity type in the selection-set filter.  It will find "heavy" 2D Polylines and 3D Polylines, but not LightWeight Polylines, and it will have the same problem with the Explode command and a multiple-object selection set.
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,080 seconds.