Jump to content
Developer Wiki and Function Reference Links ×

vectorscript: adding poly to another poly


Hippocode

Recommended Posts

What I'm trying to achieve is a custom PIO that can be compared with the HVAC Straight Duct.

Different from the Straight Duct is that I want it to be a polylone, so I can draw my ventilation way faster, including the corners.

My idea was, to offset user defined path (2d path object) once left and once right.

Then i'd try to add all the vertexes of the right new path to the left new path, so I can create a closed polygon wrapped around the user defined path.

For some reason, I can only get the coordinates/vertices of the left OR the right offset, not both of them.

Trying to add vertexes to the other fails horribly :(

Any ideas ?

		{ obtain a handle to the path polygon of the object }
	pathHd:= GetCustomObjectPath(objHd);

	{ get the number of vertices in the path }
	num_vertices:= GetVertNum(pathHd);

	{ draw the piping lines and text label }
	FOR i:= 1 TO num_vertices DO BEGIN
		GetPolylineVertex(pathHd, i, x, y, vertexType, vertexRadius);
		SetPolylineVertex(pathHd, i, x, y, 3, Afronding, TRUE);
	END;
	SetPolyClosed(pathHd, False);

	dupeHand := CreateDuplicateObject(pathHd, objHd);


  		LeftOffsetHd:= OffsetPoly(dupeHand, 10, 1, False, False, 16, 1);
  		RightOffsetHd:= OffsetPoly(dupeHand, -10, 1, False, False, 16, 1);
	FOR i:= 1 TO num_vertices DO BEGIN
		GetPolylineVertex(LeftOffsetHd, i, x, y, vertexType, vertexRadius);
		InsertVertex(RightOffsetHd,x,y,1,vertexType,vertexRadius);
{Here I assume that because I add a vertex before the first one, this new vertex will be "number one"}
	END;

Edited by hippothamus
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...