I created a custom entity derived from AcDbLine. When using DIMLIN to create a dimension by snapping to the two endpoints of the custom entity, the dimension is created, but AutoCAD displays a warning "Non-associative dimension created" and indeed the resulting dimension is not associated with the entity. When performing the same steps with an AcDbLine, the dimension is associated with the line such that changing the lines causes the dimension to update.
I can't find any documentation, sample code, or SDK header files with information about what, if anything, AutoCAD needs in order to allow associative dimensions to attach to custom objects. This thread demonstrates how to add an associative link after the fact. Several discussion group queries exactly like mine have gone unanswered over the years.
I suspect that AutoCAD either has a hard-coded list of "known" entity types that are supported; or there is a protocol extension (perhaps undocumented) that is required to map GS markers to persistent subentities.
Can anyone shed some light on the subject?
Solved! Go to Solution.
Hi Owen,
Have not played with custom objects for a quite some time now, nor use autocad in a daily basis...
It is possible that the dimension it is not started on any of the both end points?
if dimassoc==2 you can see the same message when you do not draw the dimension lines (nodes) right on the entity in this case line end-start. Maybe.
Command: DL
DIMLINEAR
Specify first extension line origin or <select object>:
Specify second extension line origin:
Non-associative dimension created.
Specify dimension line location or
[Mtext/Text/Angle/Horizontal/Vertical/Rotated]:
Dimension text = 14.6831
Hi Owen,
Look at `acdbEnableDimAssocForEntity` in `AcDimX18`. Not sure if it is now exposed through .h (it wasn't). if not, call it dynamically:
typedef Acad::ErrorStatus (*acdbEnableDimAssocForEntity_type)(AcRxClass* pClass); //... HMODULE hModule = LoadLibrary(_T("AcDimX18.dll")); if (hModule) { acdbEnableDimAssocForEntity_type f; f = (acdbEnableDimAssocForEntity_type)GetProcAddress(hModule,"acdbEnableDimAssocForEntity"); Acad::ErrorStatus es; if(f) es = f(MyLine::desc()); FreeLibrary(hModule); }
I hope it helps
@Anonymous wrote:Look at `acdbEnableDimAssocForEntity` in `AcDimX18`.
Thank you. The (3) exported functions of AcDimX<NN>.dll are the missing ingredient. They are not documented nor declared in any headers, but their signature is fairly easy to guess from their names. I also had to override AcDbEntity::subSubentPtr() (to handle kEdgeSubentType queries) for any custom entity derived directly from AcDbCurve or AcDbEntity.
Can't find what you're looking for? Ask the community or share your knowledge.