ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enable associative dimensions on custom objects?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
owenwengerd
1156 Views, 4 Replies

Enable associative dimensions on custom objects?

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?

--
Owen Wengerd
ManuSoft
4 REPLIES 4
Message 2 of 5
LE3
Advocate
in reply to: owenwengerd

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

Message 3 of 5
loic.jourdan
in reply to: owenwengerd

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

----
20-20 CAD / 20-20 Technologies
Message 4 of 5
loic.jourdan
in reply to: loic.jourdan

Edit: As you may have remarked, I've forgotten to unversion dll name AcDimX18 is for 2010/11/12... sorry

----
20-20 CAD / 20-20 Technologies
Message 5 of 5
owenwengerd
in reply to: loic.jourdan


@loic.jourdan 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.

--
Owen Wengerd
ManuSoft

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

Post to forums  

”Boost