Author Topic: bug exploding two point lwplines?  (Read 2481 times)

0 Members and 1 Guest are viewing this topic.

Joe Burke

  • Guest
bug exploding two point lwplines?
« on: February 02, 2008, 04:47:49 AM »
This might not be the right place for this question, but since it came up
while testing code I'll put it here.

I have a routine which among other things explodes lwplines which have only
two vertices. The routine reports the object count at the end. I noticed in some
cases the count went up, which shouldn't happen.

Turns out if a *closed* two point lwpline is exploded using this (vla-explode obj)
the result is TWO lines and the original lwpline. Using the explode tool the result
is correct, just one line, but only if one such object is selected. If two are
selected the result is FOUR lines. The problem does not occur if the plines are
not closed.

I checked it in 2006 and 2008. They behave the same. Can someone confirm? Also, 
has anyone heard of this before?

TIA

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #1 on: February 02, 2008, 05:45:44 AM »
Here's a vlisp example.

(defun c:bug ( / e)
  (if (setq e (car (entsel "\nSelect closed two point lwpline: ")))
    (print (vlax-invoke (vlax-ename->vla-object e) 'Explode))
  )
  (princ)
)

Command: bug
Select closed two point lwpline:
(#<VLA-OBJECT IAcadLine 06ff1d44> #<VLA-OBJECT IAcadLine 06ff29c4>)

Command: bug
Select closed two point lwpline:
(#<VLA-OBJECT IAcadArc 06fd8f74> #<VLA-OBJECT IAcadArc 06fd8f14>)

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #2 on: February 02, 2008, 06:40:29 AM »
The same problem occurs with old style heavy plines.

Here's what I get with the above routine when a two point lwpline
is *not* closed.

Command: bug
Select closed two point lwpline:
(#<VLA-OBJECT IAcadLine 06fdcc34>)

Command: bug
Select closed two point lwpline:
(#<VLA-OBJECT IAcadArc 06fd8624>)

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: bug exploding two point lwplines?
« Reply #3 on: February 02, 2008, 07:14:41 AM »
confirmed for Autocad 2004

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #4 on: February 02, 2008, 07:16:55 AM »
Thanks  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: bug exploding two point lwplines?
« Reply #5 on: February 02, 2008, 07:29:34 AM »
If the two vertex pline is CLOSED then it has two segments & I would expect it to explode to two lines.
I think the error is with the creator of a CLOSED 2 vertex pline. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #6 on: February 02, 2008, 07:51:23 AM »
Hi Alan,

Good guess, but all of this behavior can be replicated with objects created within whatever version.

The vlisp code side is one thing. What's more troublesome is the fact the native explode command is also misbehaving when more than one of these objects is selected.

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #7 on: February 02, 2008, 08:09:56 AM »
BTW, if anyone is wondering why a two point lwpline might be "closed", I haven't the faintest idea. All I know is I have many drawings from other sources which contain such objects.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: bug exploding two point lwplines?
« Reply #8 on: February 02, 2008, 08:48:15 AM »
Hi Joe

Quote
the native explode command is also misbehaving when more than one of these objects is selected.

I tried with the native command (A2007) and got two lines for each "closed 2 points plines" I exploded as well if one ore more are selected.
Speaking English as a French Frog

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #9 on: February 02, 2008, 09:08:48 AM »
If the two vertex pline is CLOSED then it has two segments & I would expect it to explode to two lines.
I think the error is with the creator of a CLOSED 2 vertex pline. 8-)

Alan,

Try it. Start the pline command. First point, second point, "cl". The result is a closed two point lwpline. The object does not have two segments.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: bug exploding two point lwplines?
« Reply #10 on: February 02, 2008, 09:29:51 AM »
Quote
Try it. Start the pline command. First point, second point, "cl". The result is a closed two point lwpline. The object does not have two segments.

Joe, it does.
Try to draw the first segment with a length of 20 units, close the pline, then look at the pline total total length: it's 40.
And (vlax-curve-getEndParam (entlast)) returns 2.0
« Last Edit: February 02, 2008, 09:40:27 AM by gile »
Speaking English as a French Frog

Joe Burke

  • Guest
Re: bug exploding two point lwplines?
« Reply #11 on: February 02, 2008, 10:00:51 AM »
gile and Allen,

What can I say other than apparently I was mistaken. Two objects from an exploded two point closed pline seems to make sense.

If nothing else, maybe this topic will serve to point out that fact.

I still cannot account for the results of some my testng which led me to think it was a bug. I'll have to backtrack...

Thanks

Josh Nieman

  • Guest
Re: bug exploding two point lwplines?
« Reply #12 on: February 02, 2008, 02:15:18 PM »
I'm with Alan.  The behavior you tell of is exactly what I would expect.

Say you have two vertices... A and B.

You draw it from A to B, then hit 'close'

Well you have two segments.  You have line segment A-B, and then there is a second line segment (created upon closure) B-A.  This line would be the same line, just starting at B and going to A, whereas the first segment was the opposite... A to B.


bah... nm... Guess I missed that last post, sorry.