Jump to content

vs.GetPolylineVertex()


DomC

Recommended Posts

Hi
Did not find some hints in the forum, so a deside to make a new post. I think I am doing something the wrong way. But What I want to do is, to grab directly data of a polyline with arcs and radius without converting them or decomposing them. So the GetPolylineVertex command looks like the right workflow for this. But what I can see (depended how the polyline is created or which tools are used to modify it) it returns the radius not directly on the returned point index. 
The only pattern I can see is, that the last radius which was returned before the vertex point is the right radius. I can imagine, that this workes as designed to bequest the value to the next value which is 0. But somehow not logical is, that other points which are type 0 (edge) contains the radius value. Someone see behind the scene here?

image.thumb.png.133ed1894e3d104ddc97322628c0d643.png

polylinie.vwx

Link to comment

I think I found it

vs.GetPolylineArcMaxRadius(hPoly, vertexNum)



Just to close question .Correction in the loop by return 0 if Vertex Type is not Radius or Arc. Also harmonized units, this function returns mm (which is in my opinion very progressive if everything would returns mm and not document units > just a thought but how many code would fail after such an update :-). So good just new things returns mm. However  here my little fiddle

obj = vs.FSActLayer()
num = vs.GetVertNum(obj)
units = vs.GetPrefReal(150)

output = []
for i in range(1, num + 1 ):
	p, vertexType, arcRadius = vs.GetPolylineVertex(obj, i)
	
	if vertexType in [3,4]:
		arcRadius = vs.GetPolylineArcMaxRadius(obj, i) / units
		
	else:
		arcRadius = 0
		
	res = p, vertexType, arcRadius
	output.append(res)

vs.CreateText('\r'.join(map(str, output)))



 

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