spettitt Posted July 21, 2024 Share Posted July 21, 2024 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 Quote Link to comment
Pat Stanford Posted July 21, 2024 Share Posted July 21, 2024 If it is stored in the Path group it may be stored as a NURBS curve instead of a polygon. Check the Object Type of path. If it is, then you should be able to use NURBSGetPt3d. Let me know if this works. HTH. Quote Link to comment
spettitt Posted July 21, 2024 Author Share Posted July 21, 2024 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. Quote Link to comment
Pat Stanford Posted July 21, 2024 Share Posted July 21, 2024 Can you post a file with a Cable Path object so I can take a look. I am sure I can create one, but if I do it differently than you, it might not be the same for what I want to do. Quote Link to comment
spettitt Posted July 21, 2024 Author Share Posted July 21, 2024 Sure, attached SimonSimonsCablePath.vwx Quote Link to comment
Pat Stanford Posted July 21, 2024 Share Posted July 21, 2024 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); Quote Link to comment
Recommended Posts
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.