How to get parent dimension elem from its text on marquee (API_Neig)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-17
06:31 AM
- last edited on
2022-10-05
01:25 PM
by
Daniel Kassai
I've tried
Directly using the guid for
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-02 03:53 PM
Ralph wrote:There!s no easy way to do that in AC22. In AC23 a new ACAPI_Goodies (APIAny_GetHierarchicalElementOwnerID, ...) will solve this issue.
Erenford wrote:I've just done a few quick tests and confirmed what you've found. Although the note is actually part of the dimension element structure, it appears to present itself independently for selection. And from the API perspective, the guid doesn't refer to an actual element.
Ralph wrote:That's what I thought as well. That's the case for other elems but the text neig has a different guid than the dimension.
The text shown in the dimension shouldn't be a separate element, i.e. the dimension and the text are bound together. So the guid in the API_Neig references the dimension.
I tried a few API calls that lookup linked or connected elements, but nothing produced a result. It's an interesting problem because it could affect at least one of our add-ons (in edge cases). Hopefully there is a call which finds the dimension linked to the note, but someone from GS might need to respond at this point.
Best, Akos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-17 11:01 AM
Erenford wrote:The text shown in the dimension shouldn't be a separate element, i.e. the dimension and the text are bound together. So the guid in the API_Neig references the dimension.
I have the dimension text on marquee, and withACAPI_Selection_GetI can get the API_Neig. I'm trying to obtain the text's parent dimension elem with just the neig, what should I use?
I've triedAPIAny_GetSelectedElementIDbut it just returns the same guid of the API_Neig.
Directly using the guid forACAPI_Element_Getreturns APIERR_BADID.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-17 02:35 PM
I couldn't find direct value but you have a bunch of vectors to play if you need to calculate a value.
If you need to access dimension note itself I would try defNote value which is API_NoteType and then content parameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-23 04:27 AM
Ralph wrote:That's what I thought as well. That's the case for other elems but the text neig has a different guid than the dimension.
The text shown in the dimension shouldn't be a separate element, i.e. the dimension and the text are bound together. So the guid in the API_Neig references the dimension.
Below, I attached my debug prints when I selected the text, and then the dimension. Plus the code I used to print it. As you can see, both have different guids. I can get the element using the guid on APINeig_DimOn, but not on the APINeig_Note. Maybe I'm missing another step? Or maybe this a bug?
Thanks for the reply.
void Test6() { API_Neig** selNeigs; API_SelectionInfo selectionInfo; BNZeroMemory(&selectionInfo, sizeof(selectionInfo)); GSErrCode err = ACAPI_Selection_Get(&selectionInfo, &selNeigs, false, true, API_InsidePartially); BMKillHandle((GSHandle*)&selectionInfo.marquee.coords); if (err != NoError) goto Test_Err; API_Element elem; const UInt32 nSel = BMGetHandleSize((GSHandle)selNeigs) / sizeof(API_Neig); WriteReport("nSel = %d", nSel); for (UInt32 ii = 0; ii < nSel && err == NoError; ++ii) { auto& neig = (*selNeigs)[ii]; Write2DebugNeig(neig); // Prints all variables of API_Neig BNZeroMemory(&elem, API_ElementSize); elem.header.guid = neig.guid; err = ACAPI_Element_Get(&elem); if (err != NoError) { WriteReport("[Error] %s - ACAPI_Element_Get()", ErrId2Name(err)); continue; } Write2DebugElem_ElemHead(elem.header); // Prints all variables of API_Elem_Head } Test_Err: BMKillHandle((GSHandle*)&selNeigs); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-23 01:53 PM
DimensionID - (API_DimElem **) - dimElems Returns the coordinates, the neig information, the text, and the witness line information of the dimension
So I would try accessing memo of API_DimensionType and then API_DimElem.
I'm not sure if you are able to access API_Note directly with API_ElementGet. Since it's not API_Element it seems not to have header and GUID?! So as far as I understand taking dimension and then access associated elements would be some way. The other maybe exploding geometry and then a note is converted to txt... but I assume that this is less satisfying since it won't be dimension anymore

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-24 05:36 AM
kzaremba wrote:This would work if I already have the Dimension elem at start.
If I understood docs correctly notes and other parts of dimension are stored in memo:
DimensionID - (API_DimElem **) - dimElems Returns the coordinates, the neig information, the text, and the witness line information of the dimensionform memo description
So I would try accessing memo of API_DimensionType and then API_DimElem.
I'm not sure if you are able to access API_Note directly with API_ElementGet. Since it's not API_Element it seems not to have header and GUID?! So as far as I understand taking dimension and then access associated elements would be some way. The other maybe exploding geometry and then a note is converted to txt... but I assume that this is less satisfying since it won't be dimension anymore![]()
My problem is that I only have the API_Neig of the text from the marquee and I want to get its parent dimension elem using only that.
Usually you can use the neig guid directly for ACAPI_Element_Get, but in this case it has different a guid, so I'm wondering if I need another function to convert it to the element guid, or something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-24 09:06 AM
Another question is do you really need it. If Note exists only when there is Dimension then instead of iterating through selected Notes iterate thru selected Dimensions. But it, of course, it depends on what you are trying to achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-04-24 01:19 PM
Erenford wrote:I've just done a few quick tests and confirmed what you've found. Although the note is actually part of the dimension element structure, it appears to present itself independently for selection. And from the API perspective, the guid doesn't refer to an actual element.
Ralph wrote:That's what I thought as well. That's the case for other elems but the text neig has a different guid than the dimension.
The text shown in the dimension shouldn't be a separate element, i.e. the dimension and the text are bound together. So the guid in the API_Neig references the dimension.
I tried a few API calls that lookup linked or connected elements, but nothing produced a result. It's an interesting problem because it could affect at least one of our add-ons (in edge cases). Hopefully there is a call which finds the dimension linked to the note, but someone from GS might need to respond at this point.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-02 03:53 PM
Ralph wrote:There!s no easy way to do that in AC22. In AC23 a new ACAPI_Goodies (APIAny_GetHierarchicalElementOwnerID, ...) will solve this issue.
Erenford wrote:I've just done a few quick tests and confirmed what you've found. Although the note is actually part of the dimension element structure, it appears to present itself independently for selection. And from the API perspective, the guid doesn't refer to an actual element.
Ralph wrote:That's what I thought as well. That's the case for other elems but the text neig has a different guid than the dimension.
The text shown in the dimension shouldn't be a separate element, i.e. the dimension and the text are bound together. So the guid in the API_Neig references the dimension.
I tried a few API calls that lookup linked or connected elements, but nothing produced a result. It's an interesting problem because it could affect at least one of our add-ons (in edge cases). Hopefully there is a call which finds the dimension linked to the note, but someone from GS might need to respond at this point.
Best, Akos