Jump to content
Developer Wiki and Function Reference Links ×

How to get the handle to the latest generated Polyline?


VvierA

Recommended Posts

Hello there,

another simple question for a beginner like me:

I generated a polyline with VS.

Closepoly;

Beginpoly;

AddPoint(0,-(PBOXWIDTH/2));

AddPoint(pLINELENGTH,-(PBOXWIDTH/2));

AddPoint(pLINELENGTH,(pBOXWIDTH/2)-(gefprozentv*pLINELENGTH));

AddPoint(0,(PBOXWIDTH/2));

Endpoly;

Now I want to change the visibility of the line segments with SetVertexVisibility.

But I need a handle to the previously generated polyline.

How do I get it?

Thank you for help

VvierA

Link to comment
  • 2 months later...

Josh, thanks for posting this, I've just used your solution to fix a problem I had creating what I thought was going to be a simple script to duplicate an object and move the duplicate by its own width plus a constant. The LNewObj command failed utterly.

Is it the command that creates the object that causes LNewObj to fail or the object type?

My code was

DUPLICATE(0,0); {the selected object}

myHandle:=LNewObj; { get its handle }

w:=HWIDTH(myHandle); { get dimension of object }

HMOVE(myHan,0,w+3.5mm); { shift dimension plus 3.5mm }

this fails to shift the duplicate whatever type of object it is.

Adding your Waldo code fixed it , though I don't understand how it works.

Steve

MacOS 10.6.8 VW 2011

Link to comment

Steve,

???The problem appears to be that DUPLICATE() does not update LNewObj, whereas LOCUS() does. So, using the Waldo technique will return the handle you are looking for.

???Waldo works because creating a locus will always create it in the present drawing context of the program - i.e., on a Design or Sheet Layer, or inside a Symbol, Group or other container object; and Locus() always updates LNewObj. Since new objects are always created on the top of the drawing stack, the PrevObj() to the locus (the one directly beneath it) is the Last-New-Object you were looking for. Once you get a handle to your object the locus can be (should be) thrown away. Now you know where Waldo 'was'.

HTH,

Raymond

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