Author Topic: setVisualStyle make no effect  (Read 22 times)

0 Members and 1 Guest are viewing this topic.

nolanjian

  • Mosquito
  • Posts: 7
setVisualStyle make no effect
« on: September 18, 2017, 02:26:53 am »
hi, community,
I want to set "Conceptual" visual style to one viewpot, but it makes no effect.
On Autocad, I find that the label on viewport change to "Conceptual", but the entities make no change, still the default style "2D wireframe".
here is my code:
Code: [Select]
void AdjustViewport(const CString& strLayout, int nIndex, const std::vector<AcDbObjectId>& vecEnt, const AcGePoint3d& modelCenter)
{
AcDbViewport* pViewport = GetViewport(strLayout, nIndex);

if (pViewport == nullptr)
{
ASSERT(pViewport != nullptr);
return;
}

int nRetActiveLayout = acedCommand(RTSTR, _T("layout"), RTSTR, _T(""), RTSTR, _T("testCopy"), 0);
ASSERT(nRetActiveLayout == RTNORM);

acedMspace();

Acad::ErrorStatus es = acedSetCurrentVPort(pViewport);
ASSERT(es == Acad::eOk);

int nSetSWISO = acedCommand(RTSTR, _T("-view"), RTSTR, _T("_swiso"), 0);
ASSERT(nSetSWISO == RTNORM);

ads_name ssname;
acedSSAdd( NULL, NULL, ssname );
GroupSelect(vecEnt, ssname);
acedSSSetFirst( ssname, NULL );
int nZOOM = acedCommand(
RTSTR, _T("_ZOOM"),
RTSTR, _T("_OBJECT"),
RTPICKS, ssname,
RTSTR, _T(""),
RTNONE);
ASSERT(nZOOM == RTNORM);
acedSSFree(ssname);
acedSSSetFirst( NULL, NULL );

AcDbObjectId vsId = AcDbObjectId::kNull;
AcDbDictionaryPointer pNOD(acdbHostApplicationServices()->workingDatabase()->visualStyleDictionaryId(), AcDb::kForRead);
pNOD->getAt(ACRX_T("Conceptual"), vsId);

Acad::ErrorStatus esSetVS = pViewport->setVisualStyle(vsId);
ASSERT(esSetVS == Acad::eOk);

//SetVisualStyle(vecEnt);

pViewport->updateDisplay();

pNOD->close();
pViewport->close();
}

pls help, thx!