IntersctWith Method fails

IntersctWith Method fails

Anonymous
Not applicable
510 Views
12 Replies
Message 1 of 13

IntersctWith Method fails

Anonymous
Not applicable
I have a drawing, drawn by someone else, that refuses to return valid
intersections of 2 arcs or an Arc & Pline. A listing of both objects'
properties gives no clues, to may anyway, of why this would be. Strange
thing is, Autocad's TRIM command will not work correctly with them, either.

I'm attaching a portion of this drawing to demonstrate this. I'm also
posting some lisp code (I know this is a VBA group, lisp is simpler for this
demonstration) that shows it does not work. If anyone has any ideas as to
why this happens and what I can do to work around it, I'd be mighty
grateful.

[code]
(defun c:IntTest (/ ent1 ent2 obj1 obj2 intpts)
(if (setq ent1 (car (entsel "\nFirst entity: "))
ent2 (car (entsel "....second entity: ")))
(progn
(setq obj1 (vlax-ename->vla-object ent1)
obj2 (vlax-ename->vla-object ent2))
(if (setq intpts (vlax-invoke obj1 'intersectwith obj2 acextendnone))
(print intpts)
(princ "\nNo intersections found.")
)
)
)
(princ)
)[/code]

Thanks,
Jeff
0 Likes
511 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable
OK, in my haste to create a small drawingto post, I copied the wrong plines.
In the drawing the 2 oval shaped plines need to be moved to the 348 & 350
elevations to match the arc they are drawn over. The problem remains the
same, however.

"Jeff Mishler" wrote in message
news:5053279@discussion.autodesk.com...
I'm attaching a portion of this drawing to demonstrate this.
0 Likes
Message 3 of 13

Anonymous
Not applicable
In the case of ones that don't work, the objects
are not coplanar.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Jeff Mishler" wrote in message news:5053279@discussion.autodesk.com...
I have a drawing, drawn by someone else, that refuses to return valid
intersections of 2 arcs or an Arc & Pline. A listing of both objects'
properties gives no clues, to may anyway, of why this would be. Strange
thing is, Autocad's TRIM command will not work correctly with them, either.
0 Likes
Message 4 of 13

Anonymous
Not applicable
After changing the elevation of one of the polylines
so that it lies in the same plane as the arc, there
was no problem. The TRIM command and the call
to IntersectWith() both work as expected.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Jeff Mishler" wrote in message news:5053318@discussion.autodesk.com...
OK, in my haste to create a small drawingto post, I copied the wrong plines.
In the drawing the 2 oval shaped plines need to be moved to the 348 & 350
elevations to match the arc they are drawn over. The problem remains the
same, however.

"Jeff Mishler" wrote in message
news:5053279@discussion.autodesk.com...
I'm attaching a portion of this drawing to demonstrate this.
0 Likes
Message 5 of 13

Anonymous
Not applicable
Thanks, Tony, for looking. Maybe what I'm expecting isn't the same as you?
I'm trying to trim the arc from the inside of the pline. Here's what I get:
After making the upper pline elevation=348 to match the upper arc, neither
trim or IntersectWith work at all.
After making the middle pline elevation = 350 to match the middle arc, trim
will trim the arc to the pline's rightmost arc and IntersectWith returns the
intersection of the arc & the pline's rightmost arc.

I would expect that both trim & IntersectWith would trim/return BOTH of the
intersections of the pline & arc for each case.
To further complicate things, lines drawn at the same time as the arcs
operate as expected!
Thanks again,
Jeff

"Tony Tanzillo" wrote in message
news:5053333@discussion.autodesk.com...
After changing the elevation of one of the polylines
so that it lies in the same plane as the arc, there
was no problem. The TRIM command and the call
to IntersectWith() both work as expected.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Jeff Mishler" wrote in message
news:5053318@discussion.autodesk.com...
OK, in my haste to create a small drawingto post, I copied the wrong plines.
In the drawing the 2 oval shaped plines need to be moved to the 348 & 350
elevations to match the arc they are drawn over. The problem remains the
same, however.

"Jeff Mishler" wrote in message
news:5053279@discussion.autodesk.com...
I'm attaching a portion of this drawing to demonstrate this.
0 Likes
Message 6 of 13

fxcastil
Advocate
Advocate
Jeff,

When you say the "trim command will not work correctly" did
you mean using trim from the command line no lisp or automation

I tried "trim"on the two samples with different trim points and they all worked as expected. The original "do not work" example

See attahed dwg, I created a copy of each trim example to the right of original location. They all worked as expected.
I did this in Ver 2002

Fred Castillo
0 Likes
Message 7 of 13

Anonymous
Not applicable
Works fine for me.

After changing the elevation of either of the two polylines
to match the Z ordinate of the intersecting arc, the TRIM
command trims the arc inside the polyline.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Jeff Mishler" wrote in message news:5053336@discussion.autodesk.com...
Thanks, Tony, for looking. Maybe what I'm expecting isn't the same as you?
I'm trying to trim the arc from the inside of the pline. Here's what I get:
After making the upper pline elevation=348 to match the upper arc, neither
trim or IntersectWith work at all.
After making the middle pline elevation = 350 to match the middle arc, trim
will trim the arc to the pline's rightmost arc and IntersectWith returns the
intersection of the arc & the pline's rightmost arc.

I would expect that both trim & IntersectWith would trim/return BOTH of the
intersections of the pline & arc for each case.
To further complicate things, lines drawn at the same time as the arcs
operate as expected!
Thanks again,
Jeff
0 Likes
Message 8 of 13

Anonymous
Not applicable
OK, I give up......
I was developing in LDD3(R2002) as that's what the customer is using and
he's the one that inquired about this problem. I just tried the same drawing
in R2006 and it works fine. What settings are there that might cause this?
I've looked at everything I can think of and am completely at a loss.

Based on Fred's results it's not due to the different versions, so it must
be some setting I'm missing......

Thanks,
Jeff

"Tony Tanzillo" wrote in message
news:5053340@discussion.autodesk.com...
Works fine for me.

After changing the elevation of either of the two polylines
to match the Z ordinate of the intersecting arc, the TRIM
command trims the arc inside the polyline.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
0 Likes
Message 9 of 13

Anonymous
Not applicable
Just to let you know that you're not completely alone, I get the same results out of TRIM that you do. Correcting the elevations didn't help. Neither did fiddling with the elevation and thickness of the polylines - until I set the elevations to zero at which point I got the results I was expecting after correcting the elvevations, even with the thicknesses set back to zero. It seems the intersection points are only found if the elevation of the polyline is zero. This is with 2005, by th eway.
0 Likes
Message 10 of 13

fxcastil
Advocate
Advocate
Jeff,


Check the "projmode" variable and "edgemode" variable

Fred Castillo
0 Likes
Message 11 of 13

Anonymous
Not applicable
Hi Fred,
Thanks, but all test platforms are set to the defaults: Edgmode=0,
Projmode=1.

wrote in message news:5053432@discussion.autodesk.com...
Jeff,


Check the "projmode" variable and "edgemode" variable

Fred Castillo
0 Likes
Message 12 of 13

Anonymous
Not applicable
Thanks, fantum.

This got me testing other things. By setting JUST the arcs to 0 elevation
allowed TRIM to work but IntersetWith still failed, but setting all objects
to 0 allowed both to work. I'm going to try implementing this into the code.


wrote in message news:5053368@discussion.autodesk.com...
Just to let you know that you're not completely alone, I get the same
results out of TRIM that you do. Correcting the elevations didn't help.
Neither did fiddling with the elevation and thickness of the polylines -
until I set the elevations to zero at which point I got the results I was
expecting after correcting the elvevations, even with the thicknesses set
back to zero. It seems the intersection points are only found if the
elevation of the polyline is zero. This is with 2005, by th eway.
0 Likes
Message 13 of 13

Anonymous
Not applicable
OK, this does work. And even though this is a VBA group I'll post the bit of
lisp code from my routine that implements this. In this case i = the
Polyline, entObj is the arc, and z is the elevation
[code]
(mapcar '(lambda (x)
(vlax-invoke x 'move (list 0.0 0.0 0.0) '(0.0 0.0 1e99))
(vlax-invoke x 'move (list 0.0 0.0 0.0) '(0.0 0.0 -1e99))
)
(list entobj i)
)
(setq intpts (vlax-invoke entobj 'intersectwith i acextendnone))
(setq p1 (list (car intpts) (cadr intpts) z)
p2 (list (car (cdddr intpts)) (cadr (cdddr intpts)) z))
(vlax-invoke entobj 'move (list 0.0 0.0 0.0) (list 0.0 0.0 z))
(vlax-invoke i 'move (list 0.0 0.0 0.0) (list 0.0 0.0 z))
[/code]
Thanks again to everyone that looked at this.
Jeff

"Jeff Mishler" wrote in message
news:5053509@discussion.autodesk.com...
Thanks, fantum.

This got me testing other things. By setting JUST the arcs to 0 elevation
allowed TRIM to work but IntersetWith still failed, but setting all objects
to 0 allowed both to work. I'm going to try implementing this into the code.
0 Likes