Jump to content
Developer Wiki and Function Reference Links ×

Handle to intersected surface


Hippocode

Recommended Posts

I seem to fail on getting a handle to an intersected surface when the intersected result is more then one surface/poly. This is a menucommand script.

h1 and h2 are created with createduplicateobject

{ find the next object }
h5 := NextObj(h2);

{ intersect }
h3 := IntersectSurface(h1, h2);

{
IF GetTypeN(h3) = 11 THEN HUngroup(h3);
}

DelObject(h1);
DelObject(h2);

WHILE (h3 <> h5) DO BEGIN 
h4:=h3;
h3 := NextObj(h3);
DelObject(h4);
END;

This doesn't delete all the surfaces and seems to fail particulary when the intersected result is more then one polygon.

Edited by hippothamus
Link to comment
  • Vectorworks, Inc Employee

The problem is probably with the assumption that the resultant intersection falls in the drawing list. It may be placed at the end of the drawing list not right after h2.

Looping using NextObj() to delete looks very unpredictable based on the use of h5.

h3 should always be a single object or group.

If it's a group you want to use fInGroup to get at the objects inside of the group and deal with the objects in the group using NextObj(). When you reach the end of the group NextObj() will return NILL.

The way you have it setup now you will find the group and then go the the next object which is outside of the group.

Either way you should be checking h3 and h4 for NILL. The way the delete loop is setup there is a very good chance you will try to delete a NILL handle and crash Vectorworks.

Link to comment

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