Closed ptm-tm closed 2 months ago
sry my mistake... need add item(i) to value
closed
You could do it like this:
from pycatia import catia
from pycatia.product_structure_interfaces.product_document import ProductDocument
caa = catia()
product_document: ProductDocument = caa.active_document
product = product_document.product
user_ref_properties = product.user_ref_properties
for i in range(len(user_ref_properties)):
index = i + 1
print(f'{user_ref_properties.item(index).name}={user_ref_properties.item(index).value}')
Maybe a little easier to read? I should update the examples to reflect this when using range on a collection.
ye) its more pythonic but im create simple for quick test..
You could do it like this:
from pycatia import catia from pycatia.product_structure_interfaces.product_document import ProductDocument caa = catia() product_document: ProductDocument = caa.active_document product = product_document.product user_ref_properties = product.user_ref_properties for i in range(len(user_ref_properties)): index = i + 1 print(f'{user_ref_properties.item(index).name}={user_ref_properties.item(index).value}')
Maybe a little easier to read? I should update the examples to reflect this when using range on a collection.
for i in user_ref_properties:
print(i.name,i.value_as_string())
its more readable... but i cant use
i.value
This is is not valid
but if we insert additional assignments - this code will be valid.
its normally?