def execute(self, context): """ Args: context: Returns: """ filepath = self.filepath # infer entitytpe from the filepath to avoid dropdown selection errors extension = filepath.split('.')[-1].lower() entitytype = self.entitytype if extension in ['sdf', 'urdf']: log( "Inferring entitytpe {entitytype} from file extension.".format( entitytype=entitytype), "INFO") entitytype = extension self.entitytype = extension log( "Importing {filepath} as {entitytype}".format( filepath=filepath, entitytype=entitytype), "INFO") model = entity_io.entity_types[entitytype]['import'](filepath) # bUtils.cleanScene() models.buildModelFromDictionary(model) for layer in ['link', 'inertial', 'visual', 'collision', 'sensor']: bUtils.toggleLayer(defs.layerTypes[layer], True) return {'FINISHED'}
def execute(self, context): log("Importing " + self.filepath + ' as ' + self.entitytype, "INFO") model = entity_io.entity_types[self.entitytype]['import'](self.filepath) # bUtils.cleanScene() models.buildModelFromDictionary(model) for layer in ['link', 'inertial', 'visual', 'collision', 'sensor']: bUtils.toggleLayer(defs.layerTypes[layer], True) return {'FINISHED'}
def execute(self, context): try: log("Importing " + self.filepath + ' as ' + self.entitytype, "INFO") model = entities.entity_types[self.entitytype]['import']( self.filepath) # bUtils.cleanScene() models.buildModelFromDictionary(model) for layer in ['link', 'inertial', 'visual', 'collision', 'sensor']: bUtils.toggleLayer(defs.layerTypes[layer], True) except KeyError: log( "No import function available for selected model type: " + self.entitytype, "ERROR") return {'FINISHED'}
def execute(self, context): """ Args: context: Returns: """ log("Importing " + self.filepath + ' as ' + self.entitytype, "INFO") model = entity_io.entity_types[self.entitytype]['import'](self.filepath) # bUtils.cleanScene() models.buildModelFromDictionary(model) for layer in ['link', 'inertial', 'visual', 'collision', 'sensor']: bUtils.toggleLayer(defs.layerTypes[layer], True) return {'FINISHED'}
def execute(self, context): """ Args: context: Returns: """ suffix = self.filepath.split(".")[-1] if suffix in entity_io.entity_types: log("Importing " + self.filepath + ' as ' + suffix, "INFO") model = entity_io.entity_types[suffix]['import'](self.filepath) # bUtils.cleanScene() models.buildModelFromDictionary(model) for layer in ['link', 'inertial', 'visual', 'collision', 'sensor']: bUtils.toggleLayer(layer, True) else: log("No module found to import " + suffix, "ERROR") return {'FINISHED'}