Importing Geometry using python API

Hi,

I’m a noob and I need to import the geometries and combine them as its done in the tutorial video but I need to use python scripts to do that. How do I do it? I tried using the following command but how do I add the file dir.

app = getApplication()

uri = “C:\Users\Guest12\Documents\Visual Components\4.0\My Models\robotControl.vcmx”

cmd = app.findCommand(“loadGeometryAsComponent”)
cmd.execute(uri)

I’m not sure where to put the uri. Besides I have no idea on how to copy one geometry and paste it in the other and make it into a single component i.e to access the geometries in a component. Could someone help with it?

Hello,

it seems that the command “loadGeometryAsComponent” is not working in version 4.0/4.1.

You could use the load()-method of the vcApplication instance. Note: In most cases, the file URI scheme is file:/// followed by the full path to file.

app = getApplication()

uri = “file:///C:/Temp/turn_unit.3ds”

newComponent = app.load( uri )

 

You can vcHelpers.Selection to access all geometry features of the new component and attach them to a feature of another component.

br/Ralle