Jump to content
Developer Wiki and Function Reference Links ×

Object handles


OhGeorgie

Recommended Posts

I've got a question about handles. I previously made a couple of plug-ins that create PFC, UB and UC symbols for the UK structural steel sections but now I'm working on the hollow sections so I need to make an poly for the outside of the square section and another for the inside and then clip them and remove the inside. I can draw the two:

 		ClosePoly;
	BeginPoly;
		MoveTo(50, 0);
		LineTo(90,0);
		ArcTo(100,0,10*3/4);
		ArcTo(100,100,10*3/4);
		ArcTo(0,100,10*3/4);
		ArcTo(0,0,10*3/4);
		LineTo(50,0);

	EndPoly;

	BeginPoly;
		MoveTo(50, 10);
		ArcTo(90,10,10/2);
		ArcTo(90,90,10/2);
		ArcTo(10,90,10/2);
		ArcTo(10,10,10/2);
		LineTo(50,10);

	EndPoly;

	PopAttrs; 

For example gives a 100x100x10 SHS. How can I use ClipSurfaces(s1,s2, HANDLE) and tell it that s1 and s2 are those two previous poly's that i just drew? Also will that keep s2 the same so I can delete it once it's clipped?

Thanks

Link to comment

Jonathan, I presume you meant using

s1 := LNewObj;

For ClipSurface(s1,s2) I used the example in the manual and I've done:

ClipSurface(s1,s2);
s3 := PrevObj(s2);
DelObject(s2);

Is that necessary because s1 is no longer an object so I need to redefine it as s3 now? s2 is not changed so I can still refer to it as thus and delete it yeah?

Thanks for your help btw. I've got it working pretty well now and I'm adding handles to some previous scripts i've written which opens new doors. Just trying to get my head around some of the procedures.

Link to comment

An alternate method would be the following code:

ClosePoly;

BeginPoly;

MoveTo(50, 0);

LineTo(90,0);

ArcTo(100,0,10*3/4);

ArcTo(100,100,10*3/4);

ArcTo(0,100,10*3/4);

ArcTo(0,0,10*3/4);

LineTo(50,0);

EndPoly;

ClipHdl:= LNewObj;

BeginPoly;

MoveTo(50, 10);

ArcTo(90,10,10/2);

ArcTo(90,90,10/2);

ArcTo(10,90,10/2);

ArcTo(10,10,10/2);

LineTo(50,10);

EndPoly;

templateHdl:= LNewObj;

IF AddHole(ClipHdl,templateHdl) THEN

BEGIN

{Delete template}

DelObject(templateHdl);

{Change clipped poly color to diagonal pattern & gray}

SetFPat(ClipHdl,25);

SetFillBack(ClipHdl,50000,50000,50000);

END;

I would prefer this method because it indicates whether the clip was successful or not. Furthermore, the method ClipSurface has changed over the years and if you need a handle to the clipped poly, its handle location may change in the future.

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