repeat command on single objects

repeat command on single objects

robert06
Collaborator Collaborator
1,179 Views
8 Replies
Message 1 of 9

repeat command on single objects

robert06
Collaborator
Collaborator

I need to run linexp.lsp by by Dominic Panholzer http://www.cadforum.cz/cadforum_en/download.asp?fileID=956 to explode plines on every single object separately to receive desired result.

 

How to achieve this correctly:

 

(defun c:lxm (/ ss i ename)
(setq ss (ssget))
(setq i -1)
(while (setq ename (ssname ss (setq i (1+ i))))
(sssetfirst nil ename)
(c:linexp)
)
(princ)
)

 

0 Likes
Accepted solutions (1)
1,180 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

For the (sssetfirst) function you need to make the ss from ename...


(sssetfirst nil (ssadd ename))

 

Btw in this case is the repeat better - you need to run thru ALL the entities... While is testing each run something, the repeat not... so repeat is little faster. 

You should also make sure that the second lisp is loaded... (untested)

 

(defun c:lxm (/ ss i )

  (if (and (setq ss (ssget))
	   (load "lineexp.lsp")
	   )
    (repeat (setq i (sslength ss))
      (sssetfirst nil (ssadd (ssname ss (setq i (1- i)))))
      (c:linexp)))
  (princ)
  )
Message 3 of 9

robert06
Collaborator
Collaborator

Thank you, the repetion works like desired now.

 

But the linexp.lsp itself still won't give correct outline shapes of polylines by their width, if a bigger amount of objects is selected or the objects are not fit on screen, I can't figure out the exact reason.

 

Robert

0 Likes
Message 4 of 9

Kent1Cooper
Consultant
Consultant

@robert06 wrote:

.... the linexp.lsp itself still won't give correct outline shapes of polylines by their width....


That's not a problem with linexp.lsp -- it's just the nature of what happens to Polylines when Exploded.  If they have width, they lose it, because they become separate Lines and Arcs, which can't have width.

 

If you want to convert a Polyline with global width into an outline, there are routines around to do that, such as this one.

Kent Cooper, AIA
0 Likes
Message 5 of 9

ВeekeeCZ
Consultant
Consultant

@robert06 wrote:

Thank you, the repetion works like desired now.

 

But the linexp.lsp itself still won't give correct outline shapes of polylines by their width, if a bigger amount of objects is selected or the objects are not fit on screen, I can't figure out the exact reason.

 

Robert


Post some test drawing... you can make a screencast to see what's happening...

0 Likes
Message 6 of 9

robert06
Collaborator
Collaborator

I use LINEXP to simplify calculating the area of paint of roadmarkings drawn with polylines, so there are several linetypes and the "spaces" must be excluded.

PLWO gives the full outline of a polyline while LINEXP gives the desired result as closed 2d polyline objects with the (almost exact) area, if few enough objects are selected and the objects are fit to screen.

 

Please see the screencast to understand this http://autode.sk/2mSDIoe

 

Robert

0 Likes
Message 7 of 9

Kent1Cooper
Consultant
Consultant

@robert06 wrote:

....the linexp.lsp itself still won't give correct outline shapes of polylines by their width....


I looked up linexp.lsp, and though I didn't load and try it, it's not just about Exploding, but apparently about breaking things of non-continuous linetypes into pieces to emulate the non-continuous linetype.  I also have a routine to do something similar, called BreakUp.lsp, available here.

 

Read the comments at the top of the file.  It is not like linexp.lsp in several ways [I'm assuming some things about linexp.lsp from their description].  It doesn't deal with complex linetypes [with embedded text or shapes], only the dash-and-gap types.  And it doesn't take the linetype from the object  or the linetype assigned to its Layer -- you have to tell it  [within each command name defined] what linetype to emulate in Breaking Up objects.  BUT [the reason I brought it up, in case this will serve your purposes] in the case of Polylines with width, since it does it by Breaking the object itself, that width is preserved, even if it varies [except for the linetypes with dots (which are zero-length dashes) -- those become Point entities].  It doesn't make outlines of them as PLWO does -- they stay Polylines with their width, but broken up into shorter pieces.  You can then [if their width is constant] convert them to outlines with PLWO, if that's what you need.

 

Another difference -- 3D Polylines don't honor  non-continuous linetypes assigned to them, but BreakUp does work with them, to break them up into pieces to emulate those linetypes.

Kent Cooper, AIA
0 Likes
Message 8 of 9

robert06
Collaborator
Collaborator

Thank you! BreakUp is great, I'd need to add my linetypes.

 

Saying that, it just lit up, why didn't I come to WMFOUT before?

This will do it for me instead of Linexp! A kudo for myself as well 🙂

 

Robert

0 Likes
Message 9 of 9

robert06
Collaborator
Collaborator

Still, no. Wmfout messes the outlines up as well.

0 Likes