Dear STKO team,
I am trying to impose fixities on faces of a solid. Can you help to correct the bold green part of the script below? Let say that I am interested in fixing the face 3 of the solid 2.
con = MpcCondition()
con.id = doc.conditions.getlastkey(0)+1
FIX_Vector.append(con.id)
con.name = 'Vincolo'
meta = doc.metaDataCondition('Constraints.sp.fix')
xobj = MpcXObject.createInstanceOf(meta)
xobj.getAttribute('Dimension').string = '3D'
xobj.getAttribute('ModelType').string = 'U (Displacement)'
xobj.getAttribute('2D').boolean = False
xobj.getAttribute('3D').boolean = True
xobj.getAttribute('U (Displacement)').boolean = True
xobj.getAttribute('U-P (Displacement+Pressure)').boolean = False
xobj.getAttribute('U-R (Displacement+Rotation)').boolean = False
xobj.getAttribute('Ux').boolean = True
xobj.getAttribute('Uy').boolean = True
xobj.getAttribute('Uz').boolean = True
con.XObject = xobj
# create the condition assignment
sset = MpcConditionIndexedSubSet()
sset.faces.append(0)
con.assignTo(so1, sset)
# add condition to document
doc.addCondition(con)
con.commitXObjectChanges()
Thank you in advance for your help.
Best wishes,
Raffaele
How to fix solid faces
-
marafini.f
- Posts: 363
- Joined: Fri Nov 13, 2020 1:52 pm
Re: How to fix solid faces
Dear Raffaele,
here is a solution for the highlighted part of your code
sset = MpcConditionIndexedSubSet()
so1 = doc.getGeometry(2)
sset.faces.append(3)
con.assignTo(so1, sset)
if you want to perform the assignment iteratively, you can use doc.geometries as a dictionary, using the method items to call the desired geometry, for example
doc.geometries.items(2,3)
Hope this helps,
let us know if you need more assistance
Enjoy your programming
Francesca
here is a solution for the highlighted part of your code
sset = MpcConditionIndexedSubSet()
so1 = doc.getGeometry(2)
sset.faces.append(3)
con.assignTo(so1, sset)
if you want to perform the assignment iteratively, you can use doc.geometries as a dictionary, using the method items to call the desired geometry, for example
doc.geometries.items(2,3)
Hope this helps,
let us know if you need more assistance
Enjoy your programming
Francesca