hasbella.blogg.se

Autocad vba polyline bulge
Autocad vba polyline bulge











autocad vba polyline bulge

Var obj = tr.GetObject(per.ObjectId, OpenMode. Peo.AddAllowedClass( typeof ( Curve ), false ) Peo.SetRejectMessage( "Must be a curve." )

autocad vba polyline bulge

Static public void ReverseCurveDirection()

AUTOCAD VBA POLYLINE BULGE CODE

Here’s the updated C# code which can now handle various types of Curve: Many thanks to Mark Dubbelaar for pointing out the Curve.ReverseCurve() method, which works perfectly on all manner of polyline. If anyone has a situation this approach doesn’t work for, please do post a comment and I’ll look into it a bit more deeply. For instance: the ECS isn’t being updated – unless it’s happening behind the scenes – so I suppose the vertex data is always relative to the first vertex added, even when the direction is reversed and that happens to be the “last” vertex… it’s not clear this is necessarily an issue, but I can imagine it could be, depending on what assumptions have been made in people’s code. I think this implementation is solid enough, but there may yet be something I’ve missed. When running the code against a standard Polyline, you shouldn’t see any difference (unless it has a linetype that happens to indicate the direction), but you can double-check using the PEDIT command, and checking which vertex gets highlighted when you edit a vertex. Write the data back to the polyline, but inįor ( int i = 0 i < pl.NumberOfVertices i++) Now let's make sure we can edit the polyline Pvd.endWidth = (i > 0 ? pl.GetEndWidthAt(i - 1) : 0) Pvd.startWidth = (i > 0 ? pl.GetStartWidthAt(i - 1) : 0) ForRead) įor ( int i = 0 i 0 ? pl.GetBulgeAt(i - 1) : 0) Peo.AddAllowedClass( typeof ( Polyline ), false ) Peo.SetRejectMessage( "Must be a polyline." ) Static public void ReversePolylineDirection() Data to be stored for each polyline vertex

autocad vba polyline bulge

It’s worth bearing in mind that the bulge is held on the index of the segment rather than the vertex, so when gathering the bulge we need to pick up the bulge of the index before for it to work properly. Here’s some code that extracts vertex information from a Polyline (storing it in a list of PerVertexData struct instances – with hindsight I might have named that struct differently, although it’s harmless enough if you parse it using capital letters to separate words/parts of words :-) and then using that information in reverse to set the vertex information as we want it. Please post a comment if this is something you’re interested in.These “complex” objects have references to separate vertex objects, which actually means it may not be much more difficult to support them (perhaps it’s even easier?), but I just haven’t looked into it as it wasn’t part of the original request.In this implementation we’ll focus on the Polyline class, rather than creating a more general solution that handles Polyline2d and Polyline3d.This seems altogether far too much like hard work, so we’ll try to manipulate the vertex data directly.Ideally we don’t want to create a brand new object, as on the one hand there may be properties we forget to copy across (extension dictionary contents, XData, etc.) but also because we’d need to worry about identity (making sure we use HandOverTo() to maintain the object’s handle, etc., for other systems tham might depend upon it).I also didn’t find anything in the public API, although that doesn’t mean there isn’t something I’ve missed (I seem to be on a bit of a roll in that respect, lately :-S :-).Ī couple of thoughts/comments on this problem: (Even nothing on your blog.) Can you help me? I’m trying to reverse the direction of a polyline thought the API, but I didn’t find something in the documentation nor in the web. This question came in by email, last week:













Autocad vba polyline bulge