
Originally Posted by
sms741514
I've found this course do be very useful, it put me on the right track regarding Geometric Constraints. However, I have a couple of problems which it doesn't answer.
The application I'm writing draws a network of lines, circles and blocks based on its input data. I use coincident constraints to keep some of the entities joined together. This means that the user can change the layout of the drawing as he wishes but the entities stay together so he can't change their meaning.
Unfortunately, I've found that some of the constraints I'm trying to apply do not work, even though a similar constraint can be applied via the user interface. In particular:
1. Circle Centre
A coincident constraint between a line an a circle can only be made against the circle's edge. Whereas the user interface constrains between the centre of the circle and the line.
I noticed that calling subEntityIdPe.GetAllSubentities(circle, SubentityType.Vertex) returns a single SubentityId. I've tried constraining the line against this but constraintGroup.AddGeometricalConstraint(GeometricalConstraint.ConstraintType.Coincident, paths) fails with an eInvalidInput exception. NB: I'm not sure what the vertex of a circle is to AutoCAD.
How can I create a coincident constraint against the centre of a circle from .NET?
2. Constraining Elements within a Block Reference.
I've found that I can create a coincident constraint between a block reference and the end of a line. This time using the Vertex subentity object does the trick. Unfortunately, this finds the centre of the block, I would really like to find the edge of a circle that is inside the block. Navigating through the objects attached to the block reference, the best I can find is the circle attached to the original block, not the block reference.
Is it possible to find the "real" entities within a block reference so that I can constrain them? Again, I am using .NET.
I wonder whether the features I need are not available through the .NET API.
If you have can share any insights on this it would be much appreciated..