.NET API for Geometric Constraint

.NET API for Geometric Constraint

Anonymous
Not applicable
1,714 Views
2 Replies
Message 1 of 3

.NET API for Geometric Constraint

Anonymous
Not applicable

I've followed the AU course on the .NET API for Geometric Constraint and found it to be very helpful. See:

http://forums.augi.com/showthread.php?162905-CP316-5-Creating-Parametric-and-Geometric-Constraints-U...

 

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 the 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. 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. 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..

0 Likes
1,715 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant

Hi,

 

Maybe you can use the 'simplified .NET API for accessing AutoCAD parameters and constraints' and just do:

 

Autodesk.ADN.AutoCAD.AssocUtil.CreateCoincidentConstraint(
line.ObjectId, circle.ObjectId, line.EndPoint, circle.Center);


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

zhenliang.fu
Contributor
Contributor

There is error when I want to use the library about AdskAdnAssocConstraintAPIMgd.dll, my software is autocad 2018 & visual studio 2015, can you give some help, thanks!

 

System.IO.FileNotFoundException: Could not load file or assembly 'AdskAdnAssocConstraintAPIMgd.dll' or one of its dependencies. The specified module could not be found.
File name: 'AdskAdnAssocConstraintAPIMgd.dll'

0 Likes