VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Ensure TextPoint is Always Inside a Closed Polyline in AutoCAD VBA?

0 REPLIES 0
Reply
Message 1 of 1
Ray-Sync
170 Views, 0 Replies

How to Ensure TextPoint is Always Inside a Closed Polyline in AutoCAD VBA?

Hi everyone,

I’m working on an AutoCAD VBA script that calculates and places angular dimensions at the vertices of a closed polyline. Everything is working fine except one thing: I need to ensure that the text position (TextPoint) for the angular dimensions is always inside the polyline.

Currently, I'm calculating TextPoint using the angle at each vertex, but sometimes it ends up outside the polyline. To fix this, I’ve tried implementing a ray-casting algorithm to check if TextPoint is inside the polyline. If it’s outside, I attempt to adjust it by moving it closer to the vertex. However, this approach doesn’t always work perfectly, and I’m not sure if it’s the most efficient method.

Here’s my current code:

RaySync_0-1725673788702.png

Is there a better way to ensure that TextPoint is always inside the polyline? Or can someone suggest improvements to my current ray-casting and adjustment method?

Any help or suggestions would be greatly appreciated!

Thanks in advance!

jefferson
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report