albie0803
Alibre Super User
This is something that I hope will help others who are learning to grapple with Python and scripting.
I wanted to add a plane to a part and so looked up the reference for add plane.
Parameters
Name Name of plane
SourcePlane Plane/face to use as basis
Offset Offset from basis plane in currently chosen units
So I tried this but got an error
P = CurrentPart()
P.AddPlane('KeyFace', Face<2>, 0)
I enquired as to why and was told to replace "Face<2>" with P.GetFace("Face<2>")
giving
P.AddPlane('KeyFace', P.GetFace("Face<2>"), 0)
which of course worked.
This led me to realise that a lot of commands don't work with text values, they work with objects.
The source plane/face parameter required not just the name of the plane/face, but a named plane/face object.
Imagine:
♥ = Face Object
♦ = Plane Object
♣ = Edge Object
♠ = Axis Object
FC = P.GetFace("Face<2>") actually creates a Face object from Face<2> called FC >> ♥(FC)
So the command is actually P.AddPlane('KeyFace', ♥(FC), 0) >> Plane Name, Face Object, Offset Distance
This concept is the same for Axis, Edge, Plane and any other item that uses a Get command
I wanted to add a plane to a part and so looked up the reference for add plane.
Parameters
Name Name of plane
SourcePlane Plane/face to use as basis
Offset Offset from basis plane in currently chosen units
So I tried this but got an error
P = CurrentPart()
P.AddPlane('KeyFace', Face<2>, 0)
I enquired as to why and was told to replace "Face<2>" with P.GetFace("Face<2>")
giving
P.AddPlane('KeyFace', P.GetFace("Face<2>"), 0)
which of course worked.
This led me to realise that a lot of commands don't work with text values, they work with objects.
The source plane/face parameter required not just the name of the plane/face, but a named plane/face object.
Imagine:
♥ = Face Object
♦ = Plane Object
♣ = Edge Object
♠ = Axis Object
FC = P.GetFace("Face<2>") actually creates a Face object from Face<2> called FC >> ♥(FC)
So the command is actually P.AddPlane('KeyFace', ♥(FC), 0) >> Plane Name, Face Object, Offset Distance
This concept is the same for Axis, Edge, Plane and any other item that uses a Get command
Last edited: