DrawingView->ActivePresentationView never returns value

DrawingView->ActivePresentationView never returns value

developerBDWXD
Explorer Explorer
391 Views
4 Replies
Message 1 of 5

DrawingView->ActivePresentationView never returns value

developerBDWXD
Explorer
Explorer

Trying to get the used presentation view used within a drawing view, but it seems not working. If presentation view is not set to associative (under Edit View...), then just get empty string (even though dialog shows name), it I turn on associative, then the ActivePresentationView method throws exception.

0 Likes
392 Views
4 Replies
Replies (4)
Message 2 of 5

johnsonshiue
Community Manager
Community Manager

Hi! This sounds like a bug to me. Could you share the code here? I would like to follow up with the project team and see what we can do.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 5

developerBDWXD
Explorer
Explorer
Hi,

For data to duplicate the issue, please use the Inventor 2019 online sample data of Fishing Rod assembly (_Fishing Rod Assembly.idw)

With that drawing open, and running this C++ code... (replace the ElString/ElLogManager with your favorite print statements)

CComPtr pDoc = m_pApplication->ActiveDocument;
if (pDoc)
{
DocumentTypeEnum eDocType = m_pApplication->ActiveDocumentType;
if (eDocType == kDrawingDocumentObject)
{
CComPtr pDwgDoc = CComQIPtr(pDoc);
CComPtr pSheets = pDwgDoc->Sheets;
if (pSheets)
{
long nSheets = pSheets->Count;
for (int i = 1; i <= nSheets; i++)
{
CComPtr pSheet = pSheets->GetItem(i);
if (pSheet)
{
CComPtr pViews = pSheet->DrawingViews;
if (pViews)
{
long nViews = pViews->Count;
for (int j = 1; j <= nViews; j++)
{
CComPtr pView = pViews->GetItem(j);
if (pView)
{
wchar_t ws_Name[1024], ws_Pres[1024], ws_Pos[1024], ws_Desg[1024], ws_LOD[1024];

wchar_t* pTemp = (wchar_t*)pView->Name;
if (pTemp)
wcsncpy(ws_Name, pTemp, 1024);
else
ws_Name[0] = 0;
pTemp = (wchar_t*)pView->ActivePresentationView;
if (pTemp)
wcsncpy(ws_Pres, pTemp, 1024);
else
ws_Pres[0] = 0;
pTemp = (wchar_t*)pView->ActivePositionalRepresentation;
if (pTemp)
wcsncpy(ws_Pos, pTemp, 1024);
else
ws_Pos[0] = 0;
pTemp = (wchar_t*)pView->ActiveLevelOfDetailRepresentation;
if (pTemp)
wcsncpy(ws_LOD, pTemp, 1024);
else
ws_LOD[0] = 0;
pTemp = (wchar_t*)pView->ActiveDesignViewRepresentation;
if (pTemp)
wcsncpy(ws_Desg, pTemp, 1024);
else
ws_Desg[0] = 0;

ElString sMsg = L"View= ";
sMsg += ws_Name;
sMsg += L", ActivePresentationView= ";
sMsg += ws_Pres;
sMsg += L", DesignView= ";
sMsg += ws_Desg;
sMsg += L", LevelOfDetail= ";
sMsg += ws_LOD;
sMsg += L", Positional= ";
sMsg += ws_Pos;
ElLogManager::Log(sMsg, AX_MT_INFO, AX_ML_0);
}
}
}
}
}
}
}
}


I get the following table of data:
[INFO] : View= VIEW13, ActivePresentationView= , DesignView= , LevelOfDetail= , Positional=
[INFO] : View= SUB-A, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= SUB-B, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= SUB-C, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= VIEW4, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= VIEW5, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= A, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= B, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= C, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= D, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= G, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= E, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= F, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= VIEW8, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= Rotate1, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate1
[INFO] : View= Rotate2, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate2
[INFO] : View= Rotate3, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate3
[INFO] : View= VIEW19, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= Rotate1, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate1
[INFO] : View= VIEW22, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate2
[INFO] : View= P, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Rotate2
[INFO] : View= VIEW18, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= L, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= VIEW20, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= I, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= K, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master
[INFO] : View= J, ActivePresentationView= , DesignView= , LevelOfDetail= Master, Positional= Master

VIEW13 is the problem. As it uses a Presentation file to set the view, I understand why LOD/Positional/Design are all empty, but I need to know the name of the used view in the presentation file in order to understand the position of each component in the view. The Fishing Rod Project file was applied when the code was run.



[cid:efd17ab9-99d5-4a08-a5cc-9ac2e53030d1]

Thanks,
Brian
0 Likes
Message 4 of 5

developerBDWXD
Explorer
Explorer

Any update on this bug?

0 Likes
Message 5 of 5

johnsonshiue
Community Manager
Community Manager

Hi! I did contact our project team and get better understanding. The issue was caused by change in Presentation API. The function needs to be enabled. So far, we don't know when it will be implemented. Please feel free to escalate it through Autodesk Product Support.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes