vcProductType
Product type is a product definition that is used to create vcProduct instances.
Properties
Name | Type | Access | Description |
Name | String | RW | Name of this product type. Must be unique within the owning process controller. |
UniqueId | String | R | Unique identifier for this product type used internally. |
FlowGroup | vcProcessFlowGroup | R |
The flow group that this product type belongs to. Use methods in vcProcessFlowGroup to associate the type to another flow group. |
IsAssembly | Boolean | R | Returns True if this product type is assembly product type. |
IsSystem | Boolean | R |
Returns True if this product type is special internal type. |
ParentProduct | vcProductType | RW | The product type this type is derived from. |
OriginFrame | vcMatrix | RW | Defines relative position of product and its component as offset from component origin to origin of product instance. |
ComponentUri | String | RW |
Simulation component type used to visualize product instances created from this product type. Setting this Uri causes the product type to immediately attempt to load and make an internal copy of the component. Note: Special “component” Uri scheme (component:componentName) can be used to point to an existing static component in the simulation layout. |
Properties | List of vcProperty | R |
Gets the properties of this product type itself. All properties might not have a vcProperty implementation. |
ComponentProperties | List of vcProperty | R | Gets the properties that are applied to components of product instances created from this product type. |
ProductProperties | List of vcProperty | R | Gets the properties that are applied to product instances created from this product type. |
Methods
Name | Return Type | Parameters | Description |
deleteProperty | None | vcProperty property |
Deletes a property of the product type itself. |
createProduct | vcProduct | [vcContainer container], [vcAssemblyConfiguration assemblyConfiguration] | Creates and returns a new product instance of this product type. If container is given, the product component will be added to it, otherwise the product is added to the world container. |
getProperty | vcProperty | String propertyName |
Returns a property of the product type itself. |
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] |
Creates a new property to the product type itself. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information. |
createComponentProperty | vcProperty |
Enumeration type, String name, [Enumeration constraints] |
Creates a new component instance property to this product type. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information. |
deleteComponentProperty |
None |
vcProperty property |
Deletes a component instance property from this product type. |
getComponentProperty | vcProperty |
String propertyName |
Returns a component instance property defined in this product type. |
createProductProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] |
Creates a new product instance property to this product type. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information. |
deleteProductProperty | None | vcProperty property |
Deletes a product instance property from this product type. |
getProductProperty | vcProperty |
String propertyName |
Returns a product instance property defined in this product type. |
resetUniqueId | None |
- |
Assigns a new unique id for this product type. |
Examples
Example. Get the vcProductType from vcProductTypeManager or vcProcessFlowGroup
from vcScript import * ''' You can get the vcProductType from vcProductTypeManager or vcProcessFlowGroup To use this snippet, load a ProductFeeder component to 3D world ProductFeeder component have already a ptoduct type defined You can also create new product types using vcProductTypeManager ''' #Access the vcProductTypeManager from the ProcessController process_controller = getSimulation().ProcessController product_type_manager = process_controller.ProductTypeManager #By defaut vcProductTypeManager have 'Any' ProductType object. To filter that we can use the IsSystem property product_type_cylinder = [x for x in product_type_manager.ProductTypes if x.IsSystem == False][0] ''' #You can also find a specific ProductType #access the vcProductType object from product manager product_type_cylinder = product_type_manager.findProductType('VC_Cylinder') ''' #change the component uri assigned to product_type_cylinder #If the component is on 3D world,eg: Cube from Products and Containers, you can assign the component to the product type like this, product_type_cylinder.ComponentUri = "component:Cube" ''' #get the list of this product type property for prop in product_type_cylinder.Properties: print prop.Name, prop.Value ''' ''' #get the list of all ComponentProperties for this product type if product_type_cylinder.ComponentProperties: for compProp in product_type_cylinder.ComponentProperties: print compProp.Name, compProp.Value ''' ''' #get the list of all ProductProperties for this product type if product_type_cylinder.ProductProperties: for prodProp in product_type_cylinder.prodProp: print prodProp.Name, prodProp.Value ''' ''' There are 3 different collections of properties in vcProductType. ProductType Property, ProductType Product property and ProductType Component property Note that adding properties to the vcProductType is different from adding them as Product properties or Component properties in the vcProductType ''' if product_type_cylinder: #add boolean property for product type. bool_prop = product_type_cylinder.getProperty('Boolean') if not bool_prop: product_type_cylinder.createProperty(VC_BOOLEAN, 'Boolean') #add real property for product property real_prop = product_type_cylinder.getProductProperty('RealProperty') if not real_prop: product_type_cylinder.createProductProperty(VC_REAL, 'RealProperty') #add integer property for component property prod_id = product_type_cylinder.getProductProperty('ProdID') if not prod_id: prod_id = product_type_cylinder.createComponentProperty (VC_INTEGER, 'ProdID') |