Copying models vs. loading them from the eCat

Hey all,

We are utilizing custom components which are heavily scripted, to make configuration as easy as possible (automatic signal connection based on interface connections, paths which are parametric based on settings, etc.).

We have noticed that when we load these models from our catalogue, they behave as expected: We can change our components (like width, number of sensors, etc.) according to our expectations. However, when we copy an existing model in the 3D environment, the copied model does not update correctly. I have attached a brief video as an example to this thread.

We were wondering what the difference is between loading a model from the eCat vs. copy-pasting it in the virtual environment? The only difference that is observable is that during copy-pasting, the ‘Opening file’ pop-up does not show up.

Is there a way to fix this issue and ‘correctly’ load our models during copy-pasting?

Kind regards,

Boon

A Switch Feature would probably not accept a property with a space like “With Drive”, so I suppose you either have another property you use to change the geometry in a “Switch” feature (which you change in the script according to the value of “With Drive”) or that you are changing the visibility directly from the script?
If so, where did you put the “OnChanged” in your script? Or can you show us the part of your script where the change should happen?

Hi Tilma,

Thank you for your rapid response! Here is a more elaborate answer based on your questions:

  1. Property Name and Switch Feature: In our case, we’re not using a Switch Feature but controlling visibility directly through script.

  2. Where the OnChanged handler is located: The OnChanged handler for the “With Drive” property is registered in our Configscript at line 1576:

if with_drive_prop:
    with_drive_prop.OnChanged = onToggleMotor
    onToggleMotor(with_drive_prop)
else:
    safe_print("Error: 'VDB::With Drive' property not found")
  1. How the change happens: The visibility change occurs in the onToggleMotor function at line 1164:
def onToggleMotor(property_object):
    """Toggle motor visibility based on 'With Drive' property."""
    if motor_object_to_toggle:
        motor_object_to_toggle.Visible = property_object.Value
        
        # Force visual refresh to make changes appear immediately
        force_visual_refresh_local()
    else:
        safe_print("Warning: 'Motor(Transmission)' feature not found")

The motor_object_to_toggle is defined as:

motor_object_to_toggle = comp.getFeature("TransformMotor")

Moreover, one of the engineers noted the following:

Regarding Copy-Paste vs. Catalog Loading: I suspect the issue is related to script initialization timing. When loading from catalog, the full initialization sequence occurs (properties loaded → scripts execute → OnChanged handlers registered → OnStart() called). However, during copy-paste operations, this sequence may be interrupted or executed in a different order, causing some OnChanged handlers to not be properly registered or executed. But this is just a guess.

Thank you once again for your time,
Boon

Hi, I’m having the same problem here. Loading our customized components from ecat works fine with property changes. But, when we copy the component and paste in 3D world, the properties of the copied component is incorrectly linked to the previous one.

How can we solve this issue?

Hi nattika,

Our ‘solution’ involved reworking the way we design our components. Now, we try to rely more heavily on manipulating the already existing parameters that we inherent from a base class in our Python scripts (e.g. a basic conveyor). This way, copy-pasting seems to work correctly.

Before, we would create our own properties based on which we would set e.g. component size.

I hope this helps, although it might not be the ‘correct’ answer!

Hello BionicBoon,

Many thanks for sharing some ideas! I’m not sure what you mean by “existing parameters inherent from a base class”.

In our case, we’re trying to change the “text label” of the customized object. The first object works fine, but after copy&paste a component, the property of the new component still links to the first component.

Even choosing “make component unique” doesn’t help.

Any suggestions from anyone would be welcome :wink: