Jump to content

Path point Z value


Recommended Posts

Hello, I'm trying to find via script the elevation change for a Cable Path object.

 

I can get the x and y OK with Get2DPt, but there is no Get3DPt in the function ref? I've tried GetPolyPt3D, which appears to just return a placeholder number e+100 number, maybe because the cable path isn't a poly.
 

import vs

def get_path_elevation(h):
	path = vs.GetCustomObjectPath(h)
	end = vs.GetVertNum(path)
	p1 = vs.Get2DPt(h, end)
	p2 = vs.Get2DPt(h, 0)
	p3d = vs.GetPolyPt3D(h, end)
	x, y, z = px
	vs.AlrtDialog(f'{end}   -   {x},       {y},         {z}')

vs.ForEachObject(get_path_elevation, "INSYMBOL & INVIEWPORT & (PON='CablePathObject')")

 

Is there a secret Get3DPt hidden away somewhere? Can't see why it wouldn't exist?

 

Thanks

 

Link to comment

Thanks Pat, no joy with that though. I can return the number of vertices reliably but that call still just returns placeholder values.

 

However, I managed to achieve what I needed by using vs.Get3DInfo to get the Z height of the whole path. That'll do for my needs.

 

Would still be interesting to know what is inside a Cable Path though and how to access the point data. Ungrouping the PIO produces a generic solid that appears to be an extrude-along-path sort of thing.

Link to comment

Try this script.  The Path is stored as a NURBS Curve inside the Path Group. The path is made up of multiple parts. Each part has multiple Points. The returned values for each point have to be offset by the insertion point of the CablePath Object.

 

I used AlrtDialog so you will have to hit return to move between the points.

 

The Documentation says that the number of pieces is 1 based, but based on my testing it is actually zero based.

 

I did not check super carefully, but the point returned for each location appears to be close to what I can see in the ruler bar.

 

HTH.

 

Procedure Test;

VAR	H1,H2					:Handle;
	X1,Y1,Z1,X2,Y2,Z2		:Real;
	N1,N2,N3				:Integer;
	L1,L2					:LongInt;
	
BEGIN
	H1:=FSActLayer;
	H2:=GetCustomObjectPath(H1);
	GetSymLoc3D(H1, X2,Y2,Z2);
	AlrtDialog(Concat('The Path Object Type is: ',GetType(H2)));
	N1:=NurbsCurveGetNumPieces(H2);
	
	For N2:=0 to N1 DO
		BEGIN
			L1:=NurbsGetNumPts(H2, N2);
			For L2 := 0 to L1-1 DO
				BEGIN
					NurbsGetPt3D(H2,N2,L2,X1,Y1,Z1);
					AlrtDialog(Concat('Piece:',N2,'  Point:',L2,'   X:',X2+X1,'   Y:',Y2+Y1,'   Z:',Z2+Z1));
				End;
		End;
End;

Run(Test);

 

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