ObjectARX, AutoCAD. Среда программирования библиотеки C++


         

is not loaded, the current


if (getLinetypeIdFromString("DASHDOT", dashdotId) == Acad::eOk)
{
pW->subEntityTraits().setLineType(dashdotId);
}
// Force current layer to "MY_LAYER". If
// "MY_LAYER" is not loaded, the current layer
// will still be in effect.
//
AcDbObjectId layerId;
if (getLayerIdFromString("MY_LAYER", layerId) == Acad::eOk)
{
pW->subEntityTraits().setLayer(layerId);
}
// Draw a DASHDOT xline in "MY_LAYER"’s color.
//
pW->geometry().xline(pVerts[0], pVerts[2]);
delete [] pVerts;
return Adesk::kTrue;
}
// A useful function that gets the linetype ID from the
// linetype’s name; the name must be in upper case.
//
static Acad::ErrorStatus
getLinetypeIdFromString(const char* str, AcDbObjectId& id)
{
Acad::ErrorStatus err;
// Get the table of currently loaded linetypes.
//
AcDbLinetypeTable *pLinetypeTable;
err = acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pLinetypeTable, AcDb::kForRead);
if (err != Acad::eOk)
return err;
// Get the ID of the linetype with the name that
// str contains.
//
err = pLinetypeTable->getAt(str, id, Adesk::kTrue);
pLinetypeTable->close();
return err;
}
// A useful function that gets the layer ID from the
// layer’s name; the layer name must be in upper case.
//
static Acad::ErrorStatus
getLayerIdFromString(const char* str, AcDbObjectId& id)
{
Acad::ErrorStatus err;
// Get the table of currently loaded layers.
//
AcDbLayerTable *pLayerTable;
err = acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pLayerTable, AcDb::kForRead);
if (err != Acad::eOk)
return err;
// Get the ID of the layer with the name that str
// contains.
//
err = pLayerTable->getAt(str, id, Adesk::kTrue);
pLayerTable->close();
return err;
}

Содержание  Назад  Вперед