Python Place eCatalog Model in 3d Sim

Hello everybody,
I´ve got a quick question. I am trying to create a component from the e-catalog via my python code. I want to place it in the 3d world, adjust the properties, rename it and place it. I am missing the function to load the geometry/thing from the e-cad. Can anyone point me to the right function/page in the python api? Or is there a .net code I have to call via python?

My code so far:

from vcCommand import *

def placeComponent():
    print("HelloWorld")
    #Get Application to use netCommands and do things in the Sim
    app = getApplication()
    cmd = app.findCommand("netCommand")
    sm = app.SelectionManager
    
    # Pyton for .Net syntax    cmd.execute("ImportCADFiles", [True])

    comp = app.createComponent()
    comp.getProperty("Name").Value = "Test"
    comp.createProperty(VC_INTEGER, "Test_int")

    # Change this part from Block to Elements from the E-Catalog/ vcmx data
    comp = app.findComponent("Test") 
    comp.RootFeature.createFeature(VC_BLOCK, "MyBlock")

    sm.setSelection(comp)
    print(comp)
    sm.setSelection(comp)
    print(comp)

Hy,

with python scripting you realize more component logic.

I think you better realize your plan with a .net-AddIn…

Regards
Feature

In general - I agree. But because of various reasons, I am restriced to write my code in python.

Which function from .Net would be viable for that approach of loading a component from the E-Catalog?

Hy,

I would try this…

Regards
Feature

Thanks a lot! The key words “Load Layout” helped me find these other questions from other users. I managed to combine the solutions, it works out fine now. I didn´t get the .LaodLayout to work, python got a load() function that worked similary for me.

KR

J

Posts I am refering to: