Ejemplo n.º 1
0
bool
Axis2Placement3D::Load(STEPWrapper *sw,SDAI_Application_instance *sse) {
    step=sw;
    id = sse->STEPfile_id;

    if ( !Placement::Load(step,sse) ) {
	std::cout << CLASSNAME << ":Error loading base class ::Placement." << std::endl;
	return false;
    }

    // need to do this for local attributes to makes sure we have
    // the actual entity and not a complex/supertype parent
    sse = step->getEntity(sse,ENTITYNAME);

    if (axis == NULL) {
	SDAI_Application_instance *entity = step->getEntityAttribute(sse,"axis");
	if (entity) {
	    axis = dynamic_cast<Direction *>(Factory::CreateObject(sw,entity));
	} else { // optional so no problem if not here
	    axis = NULL;
	}
    }

    if (ref_direction == NULL) {
	SDAI_Application_instance *entity = step->getEntityAttribute(sse,"ref_direction");
	if (entity) {
	    ref_direction = dynamic_cast<Direction *>(Factory::CreateObject(sw,entity));
	} else { // optional so no problem if not here
	    ref_direction = NULL;
	}
    }

    BuildAxis();

    return true;
}
DWORD CCoordinateToolManager::OnAddAxis(DWORD size, void *params)
{
	VERIFY_MESSAGE_SIZE(sizeof(ADDAXISPARAMS), size);
	ADDAXISPARAMS *ax = (ADDAXISPARAMS*)params;


	if( m_CoordinateToolName == NULL )
	{
		BuildAxis(ax->name);
	}
	else
	{
		CHashString typeName = _T("CCoordinateTool");
		static DWORD msg_SetParent = CHashString(_T("SetParent")).GetUniqueID();
		if (m_ToolBox->SendMessage(msg_SetParent, sizeof(IHashString), ax->name, m_CoordinateToolName, &m_hszCoordinateToolClass) != MSG_HANDLED)
		{
			// if all objects are deleted and the parent is world it never gets in here...
			m_ToolBox->Log(LOGERROR, _T("CCoordinateToolManager: Failed to set coordinate tool parent!\n"));
			return MSG_HANDLED_STOP;
		}
	}

	return MSG_HANDLED_STOP;
}