This is MagicPanels library for Woodworking workbench.
Darek L (github.com/dprojects)
Usage:
import MagicPanels
returned_value = MagicPanels.function(args)
Functions at this library:
- Should not have error handling and pop-ups, so you can call it from GUI tools in loops.
- Should return value, if further processing needed.
gRoundPrecision = 2 # should be set according to the user FreeCAD GUI settings gSearchDepth = 200 # recursive search depth
Description:
This function checks if the given object iObj is iType.
It has been created mostly for Clones. The Clones are "Part::FeaturePython" type.
But the problem is that many other FreeCAD objects are "Part::FeaturePython" type as well,
for example Array. So, you can't recognize the Clones only with .isDerivedFrom() function or
even .TypeId. To simplify the code look you can hide the ckecks behind the function.
iObj: object
iType: string for type:
"Clone" - for clones
if MagicPanels.isType(o, "Clone"):
do something ...
return True or False, so you can use it directly in if statement
Description:
At FreeCAD there are many values like 1.000006, especially for PartDesign objects.
So if you want to compare such values this sometimes might be True and sometimes False.
So, finally I decided to write my own function for comparison.
iA: float value
iB: float value
if MagicPanels.equal(1.0006, 1):
do something ...
return True if equal or False if not
Description:
Touch the typo so that the typo-snake does not notice it ;-) LOL
iObj: object to touch
vs = MagicPanels.touchTypo(o)
return Vertex + es for object o
Description:
Return normalized version of BoundBox. All values 0.01 will be rounded
allowing comparison, and searches for the same face or edge.
iBoundBox: directly pass BoundBox object
e1 = obj1.Shape.Edges[0]
e2 = obj2.Shape.Edges[0]
b1 = MagicPanels.normalizeBoundBox(e1.BoundBox)
b2 = MagicPanels.normalizeBoundBox(e2.BoundBox)
return normalized version for comparison if b1 == b2: you can set your own precision here
Description:
Create sphere at given vertices, to show where are the points for debug purposes.
iVertices: array with Vertex or floats objects
iRadius (optional): ball Radius
iColor: string "red", "green", "blue", or color tuple like (1.0, 0.0, 0.0, 0.0)
MagicPanels.showVertex([ obj.Shape.CenterOfMass ], 20)
remove old vertices and show new ones, return array of objects, spheres
Description:
Get vertex values for face, edge and vertex index.
iFace: face object
iEdge: edge array index
iVertex: vertex array index (0 or 1)
[ x, y, z ] = MagicPanels.getVertex(gFace, 0, 1)
Return vertex position.
Description:
Returns vertex index for given object and vertex object.
iObj: object of the vertex
iVertex: vertex object
vertexIndex = MagicPanels.getVertexIndex(o, v)
return int value for vertex name, so you can create string Vertex + vertexIndex,
or get vertex from vertices array
Description:
Return difference between iB and iA values with respect of coordinate axes.
iA: vertex float value
iB: vertex float value
edgeSize = MagicPanels.getVertexAxisCross(v0[0], v1[0])
Return diff for vertices values.
Description:
Gets axes with the same values.
iV1: vertex object
iV2: vertex object
plane = MagicPanels.getVerticesPlane(v1, v2)
Return plane as "XY", "XZ", "YZ".
Description:
Sets padding offset from given vertex to inside the object.
Do not use it at getPlacement for Pads. Use 0 vertex instead.
Note: This need to be improved.
iObj: object
iVertex: vertex object FreeCAD.Vector(x, y, z)
iPadding: value > 0 for making offset
iAxis: string: "X" or "Y" or "Z"
v = getattr(obj.Shape, "Vertex"+"es")[0]
offsetX = MagicPanels.setVertexPadding(obj, v, 15, "X")
Return return new position value for given axis.
Description:
This function has been created to replace python .index() function.
FreeCAD has not rounded float values at Vectors, so if you call
iCurve.Shape.getPoints(1)[0].index(vector_of_iPoint) this may not find the index
of vector_of_iPoint at the iCurve not because it is not there, but because there is
small not rounded difference, for example 0.0000006. So, this function scan the iCurve vectors
and compare rounded values to return the index.
iPoint: Part.Vertex object or FreeCAD.Vector or array of floats like [ x, y, z ]
iCurve: object that has .getPoints() function, for example Wire, Sketch, Helix, Edge
index = MagicPanels.getOnCurve(v, Sketch)
Return int value index for iPoint on iCurve.
Description:
Gets all vertices values for edge.
iEdge: edge object
[ v1, v2 ] = MagicPanels.getEdgeVertices(gEdge)
Return vertices array like [ [ 1, 1, 1 ], [ 1, 1, 1 ] ].
Description:
Returns vertices with exact sorted order V1 > V2, mostly used
to normalize Pad vertices.
iV1: array with vertices e.g. [ 1, 1, 1 ]
iV2: array with vertices e.g. [ 2, 2, 2 ]
[ v1, v2 ] = MagicPanels.getEdgeNormalized(v1, v2)
for vertices [ 2, 2, 2 ], [ 1, 1, 1 ] return [ 1, 1, 1 ], [ 2, 2, 2 ]
Description:
Returns edge index for given object and edge.
iObj: object of the edge
iEdge: edge object
edgeIndex = MagicPanels.getEdgeIndex(gObj, gEdge)
return int value for edge
Description:
Returns edge index for given edge BoundBox.
iObj: object of the edge
iBoundBox: edge BoundBox as key
edgeIndex = MagicPanels.getEdgeIndex(o, key)
return int value for edge
Description:
Returns orientation for the edge, changed axis, as "X", "Y" or "Z".
iObj: object with the edge
iEdge: edge object
plane = MagicPanels.getEdgePlane(o, edge)
return string "X", "Y" or "Z".
Description:
This is extended version of getEdgeIndexByKey function.
This function has been created to solve resized edge problem. If you cut the edge the next
edge will change the Length. So, also the BoundBox will be changed. With this function you
can customize reference key to solve the Topology Naming Problem.
iObj: object for the sub-object
iKey: array with keys
iType: type of comparison
iSubType: type of sub-object to return, "edge" or "face"
key = [ e.CenterOfMass, plane ]
[ edge, edgeName, edgeIndex ] = MagicPanels.getSubByKey(o, key, "CenterOfMass", "edge")
return edge object, name like Edge1 and also index starting from 0 (for iObj.Shape.Edges[index])
Description:
Returns Rotation object which can be passed directly to setSketchPlacement
functions. The Sketch will be perpendicular to the iSub object, so it can be used as
router bit to cut the edge or face.
iObj: object for sub-object
iSub: selected sub-object, edge or face
r = MagicPanels.getSketchPatternRotation(o, edge)
r = MagicPanels.getSketchPatternRotation(o, face)
return FreeCAD.Rotation object.
Description:
This function is router for the edge. It cut the
iSub with iSketch pattern. The new object will get iLabel label.
iPad: Pad object of the sub-object, for routing
iSub: sub-object, edge or face
iSketch: sketch object will be used as pattern to cut, the sketch should be around XYZ center cross.
iLength: length to cut, float or int value, 0 means ThroughAll
iLabel: label for new object
iType: type of routing
router = MagicPanels.edgeRouter(pad, edge, sketch, 0, "routerCove", "simple")
return router object, the result of cut
Description:
This function is multi Pocket. First object from iObjects will be base
object to Pocket, all others should be Sketches. The Length is depth for Pocket.
If the Length is 0 the Pocket will be ThroughAll.
iObjects: First base objects, next sketches
iLength: length to cut, float or int value, 0 means ThroughAll
pocket = MagicPanels.makePockets(selectedObjects, 0)
return last pocket object, the result of cut
Description:
Returns face index for given object and face.
iObj: object of the face
iFace: face object
faceIndex = MagicPanels.getFaceIndex(gObj, gFace)
return int value for face
Description:
Returns face index for given face BoundBox.
iObj: object of the face
iBoundBox: face BoundBox as key
faceIndex = MagicPanels.getFaceIndexByKey(o, key)
return int value for face
Description:
Gets all vertices values for face.
iFace: face object
iType (optional):
* "4" - 4 vertices for normal Cube
* "all" - get all vertices, for example for Cut object
[ v1, v2, v3, v4 ] = MagicPanels.getFaceVertices(gFace)
vertices = MagicPanels.getFaceVertices(gFace, "all")
Return vertices array like [ [ 1, 1, 1 ], [ 2, 2, 2 ], [ 3, 3, 3 ], [ 4, 4, 4 ] ]
Description:
Gets face type, if this is "edge" or "surface".
iObj: object where is the face
iFace: face object
faceType = MagicPanels.getFaceType(gObj, gFace)
Return string "surface" or "edge".
Description:
Gets all edges for given face grouped by sizes.
iObj: object where is the face
iFace: face object
[ faceType, arrAll, arrThick, arrShort, arrLong ] = MagicPanels.getFaceEdges(gObj, gFace)
Return arrays like [ faceType, arrAll, arrThick, arrShort, arrLong ] with edges objects,
faceType - string "surface" or "edge"
arrAll - array with all edges
arrThick - array with the thickness edges
arrShort - array with the short edges (if type is edge this will be the same as arrThick)
arrLong - array with the long edges
Description:
Gets face plane in notation "XY", "XZ", "YZ".
iFace: face object
plane = MagicPanels.getFacePlane(face)
string "XY", "XZ", or "YZ".
Description:
Gets face sink axis direction in notation "+", or "-".
iObj: object with the face
iFace: face object
sink = MagicPanels.getFaceSink(obj, face)
string "+" if the object at face should go along axis forward,
or "-" if the object at face should go along axis backward
Description:
Gets face object rotation to apply to the new created object at face.
Object created at face with this rotation should be up from the face.
iObj: object with the face
iFace: face object
r = MagicPanels.getFaceObjectRotation(obj, face)
FreeCAD.Rotation object that can be directly pass to the setPlacement or object.Placement
Description:
Allows to get detailed information for face direction.
iObj: selected object
iFace: selected face object
[ plane, type ] = MagicPanels.getFaceDetails(gObj, gFace)
[ "XY", "surface" ] - if the direction is XY and it is surface, no thickness edge
[ "XY", "edge" ] - if the direction is XY and it is edge, there is thickness edge
[ "XY", "equal" ] - if the direction is XY and both edges are equal
Note: The first argument can be "XY", "YX", "XZ", "ZX", "YZ", "ZY".
This is related to face not to object. The object direction will be different.
Description:
Gets reference to the selected or given object.
iObj (optional): object to get reference (to return base object)
gObj = MagicPanels.getReference()
gObj = MagicPanels.getReference(obj)
gObj - reference to the base object
Description:
Allows to get sizes for object (iObj), according to the object type.
The values are not sorted.
iObj: object to get sizes
[ size1, size2, size3 ] = MagicPanels.getSizes(obj)
Returns [ Length, Width, Height ] for Cube.
Description:
Gets occupied space by the object from vertices.
iObj: object
[ sx, sy, sz ] = MagicPanels.getSizesFromVertices(obj)
Returns array with [ mX, mY, mZ ] where:
mX - occupied space along X axis
mY - occupied space along Y axis
mZ - occupied space along Z axis
Description:
Gets occupied space by the object from BoundBox. This can be useful for round shapes,
where is no vertices at object edges, e.g. cylinders, circle at Sketch.
iObj: object
[ sx, sy, sz ] = MagicPanels.getSizesFromVertices(obj)
Returns array with [ mX, mY, mZ ] where:
mX - occupied space along X axis
mY - occupied space along Y axis
mZ - occupied space along Z axis
Description:
Creates measurements object, I mean draw it. Now it use FreeCAD function
to create and draw object. But in the future this can be changed to
more beautiful drawing without changing tools.
iP1: starting point vertex object
iP2: ending point vertex object
iRef (optional): string for future TechDraw import or any other use, other tools
m = MagicPanels.showMeasure(gP1, gP2, "Pad")
Create measure object, draw it and return measure object for further processing.
Description:
Gets distance between iFace1 and iFace2.
iObj1: object of iFace1
iObj2: object of iFace2
iFace1: face object
iFace2: face object
size = MagicPanels.getDistanceBetweenFaces(o1, o2, face1, face2)
return distance between face1 object and face2 object
Description:
Function to check if object iObj is rotated or not.
iObj: object to check rotation
if MagicPanels.isRotated(o):
Return True if the object is rotated or False otherwise.
Description:
This function checks if the iObj is rotated and add the rotation to the iTarget objects.
iObj: object to check rotation
iTarget: array with objects to set rotation
MagicPanels.addRotation(base, [ o ]):
If the iObj is rotated, set the same rotation to iTarget
Description:
Transform given iX, iY, iZ values to the correct vector, if the user rotated 3D model.
iX: X value to transform
iY: Y value to transform
iY: Z value to transform
[x, y, z ] = MagicPanels.getModelRotation(x, y, z)
[ X, Y, Z ] - transformed vector of given values
Description:
Allows to get Cube object direction (iType).
iObj: selected object
direction = MagicPanels.getDirection(obj)
Returns iType: "XY", "YX", "XZ", "ZX", "YZ", "ZY"
Description:
Reset placement for given object. Needed to set rotation for object at face.
iObj: object to reset placement
MagicPanels.resetPlacement(obj)
Object obj return to base position.
Description:
Gets placement with rotation info for given object.
Note: This is useful if you not use containers.
iObj: object to get placement
[ x, y, z, r ] = MagicPanels.getPlacement(gObj)
return [ x, y, z, r ] array with placement info, where:
x: X Axis object position
y: Y Axis object position
z: Z Axis object position
r: Rotation object
Description:
Calls FreeCAD getGlobalPlacement at base object, and return useful form of placement.
iObj: object to get placement
[ x, y, z, r ] = MagicPanels.getGlobalPlacement(o)
return [ x, y, z, r ] array with placement info, where:
x: X Axis object position
y: Y Axis object position
z: Z Axis object position
r: Rotation object
Description:
Sets placement with rotation for given object.
iObj: object to set custom placement and rotation
iX: X Axis object position
iX: Y Axis object position
iZ: Z Axis object position
iR: Rotation object
iAnchor="" (optional): anchor for placement instead of 0 vertex, FreeCAD.Vector(x, y, z)
MagicPanels.setPlacement(gObj, 100, 100, 200, r)
Object gObj should be moved into 100, 100, 200 position without rotation.
Description:
Gets placement dedicated to move and copy Sketch directly.
iSketch: Sketch object
iType:
"attach" - AttachmentOffset position, need to be converted later
"clean" - directly from Placement, so the AttachmentOffset don't need to be converted
"global" - global Sketch position, can be directly set to object
[ x, y, z, r ] = MagicPanels.getSketchPlacement(sketch, "global")
return [ x, y, z, r ] array with placement info, where:
x: X Axis object position
y: Y Axis object position
z: Z Axis object position
r: Rotation object
Description:
Set placement with rotation dedicated to move and copy Sketch directly.
iSketch: Sketch object to set custom placement and rotation
iX: X Axis object position
iX: Y Axis object position
iZ: Z Axis object position
iR: Rotation object
iType:
"global" - global Sketch position, good before Pocket or any other operation, Sketch global
position is temporary, FreeCAD bug? after Sketch edit the Sketch position will
be lost, use "attach" to keep it
"attach" - AttachmentOffset position, global position will be converted to AttachmentOffset,
make sure the Support is set for Sketch, the Clones may not have Support,
use global instead
"auto" - recognize if Sketch has Support, if yes this will be "attach", if no Support this
will be "global", it is useful to move Pads
MagicPanels.setSketchPlacement(sketch, 100, 100, 200, r, "global")
Object Sketch should be moved.
Description:
Returns center of the object.
Note: This function will be updated later with more reliable
way of getting center of the object, also for LinkGroup and other containers.
Now it returns Shape.CenterOfMass for the object and it is not the same
as center of the object.
iObj: object
[ cx, cy, cz ] = MagicPanels.getObjectCenter(obj)
Returns array with [ cx, cy, cz ] values for center point.
Description:
This function get list of containers for give iObj.
iObj: object to get list of containers
containers = MagicPanels.getContainers(o)
return array with objects
Description:
This function set label for nesting objects, containers, copied, to not repeat
the prefix and not make the label too long.
iObj: object for the label check
iPrefix: string, preferred prefix for the label
o.Label = MagicPanels.getNestingLabel(o, "Container")
return string for the new label
Description:
If the object is in the container like Part, Body, LinkGroup the vertices are
not updated by FreeCAD. From FreeCAD perspective the object is still in the
same place. This function is trying to solve this problem and calculates
all offsets of all containers.
iObj: object to get containers offset
[ coX, coY, coZ, coR ] = MagicPanels.getContainersOffset(o)
return [ coX, coY, coZ, coR ] array with offsets for placement:
coX: X Axis object position
coY: Y Axis object position
coZ: Z Axis object position
coR: Rotation object
Gets iObj offset of all supported containers for vertices iVertices.
iObj: object to get containers offset
iVertices: vertices array
iType:
"array" - array with floats [ 1, 2, 3 ]
"vector" - array with FreeCAD.Vector types
vertices = MagicPanels.getVerticesOffset(vertices, o, "array")
return vertices array with correct container offset
Description:
Gets iVertices 3D position. This function should be used to show or select iVertices with rotation.
It calculates all offsets with rotation. But this function should not be used for calculation.
Because the vertices at FreeCAD are raw, without containers offset. The vertices at FreeCAD have only
AttachmentOffset applied. If you start calculation with rotation, you need to calculate plane correctly.
iVertices: vertices array
iObj: object to get containers offset
iType:
"auto" - recognize the iVertices elements type
"array" - each element of iVertices is array with floats [ 1, 2, 3 ]
"vector" - each element of iVertices is array with FreeCAD.Vector
"vertex" - each element of iVertices is array with Part.Vertex
[[ x, y, z ]] = MagicPanels.getVerticesPosition([[ x, y, z ]], o, "array")
vertices = MagicPanels.getVerticesPosition(vertices, o, "vector")
vertices = MagicPanels.getVerticesPosition(vertices, o)
MagicPanels.showVertex(vertices, 10)
return vertices array with correct container offset, with the same type
Description:
Remove iVertices 3D position. This function removes offset calculated with getVerticesPosition.
iVertices: vertices array
iObj: object to remove containers offset
iType:
"auto" - recognize the iVertices elements type
"array" - each element of iVertices is array with floats [ 1, 2, 3 ]
"vector" - each element of iVertices is array with FreeCAD.Vector
"vertex" - each element of iVertices is array with Part.Vertex
[[ x, y, z ]] = MagicPanels.removeVerticesPosition([[ x, y, z ]], o, "array")
vertices = MagicPanels.removeVerticesPosition(vertices, o, "vector")
vertices = MagicPanels.removeVerticesPosition(vertices, o)
MagicPanels.showVertex(vertices, 10)
return vertices array without container offset, with the same type
Description:
Move objects iObjects to clean container for iSelection object.
Container need to be in the clean path, no other objects except Group or LinkGroup,
For example:
clean path: LinkGroup -> LinkGroup
not clean: Mirror -> LinkGroup
iObjects: list of objects to move to container, for example new created Cube
iSelection: selected object, for example Pad
MagicPanels.moveToClean([ o ], pad)
No return, move object.
Description:
Move objects iObjects to first container above Body for iSelection object.
This can be used to force object at face to be moved into Mirror -> LinkGroup.
This function removes the offset that should have been added earlier. Why not just copy without offset?
If you have 2 objects in separate containers and the second object is only moved via the container Placment,
then from FreeCAD point the objects are in the same place. So you won't be able to compute space between
objects in these containers. FreeCAD uses local positions. It's good because you can calculate many things
without using advanced formulas. Adding an offset and removing it later is a trick for easier calculations.
You can convert all vertices to global, but in this case you won't be able to determine the plane correctly
in an easy way, for example the vertices on an edge would no longer be along the same coordinate axis,
and thus you'd have to use advanced formulas. It can be done with a trick, but maybe something like
that will come along later if need be.
iObjects: list of objects to move to container, for example new created Cube
iSelection: selected object, for example Pad
MagicPanels.moveToFirst([ o ], pad)
No return, move object.
Description:
This version remove the placement and rotation offset from iObjects and move the iObjects to first
supported container (LinkGroup).
Note: It is dedicated to move panel created from vertices to the first LinkGroup container.
The object created from vertices have applied offset with rotation after creation
but is outside the container. So if you move it manually it will be in the wrong place because
container apply the placement and rotation again. So, you have to remove the offset and move it.
Yea, that's the beauty of FreeCAD ;-)
iObjects: list of objects to move to container, for example new created Cube
iSelection: selected object, for example Pad
MagicPanels.moveToFirstWithInverse([ o ], pad)
No return, move object.
Description:
This version move object to parent container without adding or remove offset. This is useful if you copy the
Sketch, because SKetch after copy is located outside Body, in Part. But if the Part is inside LinkGroup
the copied Sketch will be located outside LinkGroup, in main root folder. This is problematic because
the Sketch after copy has offset from containers. The object to move need to be in root folder to avoid
duplicated already copied objects, Cube.
iObjects: list of objects to move to container, for example new created Sketch
iSelection: selected object, for example Sketch
MagicPanels.moveToParent([ copy ], sketch)
No return, move object.
Description:
This function returns object to move.
iObj: object to get placement, selected container or base reference object
toMove = MagicPanels.getObjectToMove(o)
For example:
for Cube: always returns Cube
for Pad: always returns Body
for LinkGroup: returns LinkGroup
for Cut: returns Cut
for other PartDesign objects: try to return Body
for any other object: returns object
Description:
This function creates container for given iObjects. The label for new container will be get from
first element of iObjects (iObjects[0]).
iObjects: array of object to create container for them
iLabel: container label
container = MagicPanels.createContainer([c1, c2])
container = MagicPanels.createContainer([c1, c2], "LinkGroup")
Created container and objects inside the container, return container object.
Description:
This function returns placement for the object with all
containers offsets or clean. The given object might be container or
selected object, the base Cube or Pad.
iObj: object to get placement
iType (optional):
"clean" - to get iObj.Placement,
"offset" to get iObj.Placement with containers offset.
[ x, y, z, r ] = MagicPanels.getContainerPlacement(o, "clean")
[ x, y, z, r ] = MagicPanels.getContainerPlacement(o, "offset")
return [ x, y, z, r ] array with placement info, where:
x: X Axis object position
y: Y Axis object position
z: Z Axis object position
r: Rotation object - not supported yet
Description:
Return diff that should be added to iStart to move object from iStart to iDestination position.
If you want to move back you can minus the diff from iDestination.
iStart: start vertex float value
iDestination: destination vertex float value
[ moveX, moveY, moveZ ] = MagicPanels.getPlacementDiff(v1, v2)
Return [ moveX, moveY, moveZ ] array with X, Y, Z floats to move object.
Description:
Set placement function, especially used with containers.
iObj: object or container to set placement, for example Body, LinkGroup, Cut, Pad, Cube, Sketch, Cylinder
iX: X Axis object position
iX: Y Axis object position
iZ: Z Axis object position
iR:
0 - means rotation value set to iObj.Placement.Rotation
R - custom FreeCAD.Placement.Rotation object
iAnchor (optional):
"clean" - set directly to iObj.Placement, if object is Pad set to Sketch directly
"normal" - default object anchor with global vertices calculation
"center" - anchor will be center of the object (CenterOfMass)
[ iAX, iAY, iAZ ] - custom anchor, this should be global position
MagicPanels.setContainerPlacement(cube, 100, 100, 200, 0, "clean")
MagicPanels.setContainerPlacement(pad, 100, 100, 200, 0, "normal")
MagicPanels.setContainerPlacement(body, 100, 100, 200, 0, "center")
Object should be moved into 100, 100, 200 position with exact anchor.
Description:
Convert given position vector to correct position values according
to the object direction.
iObj: object
iX: x position
iY: y position
iZ: z position
[ x, y, z ] = MagicPanels.convertPosition(obj, 0, 400, 0)
For Pad object in XZ direction return the AttachmentOffset order [ 0, 0, -400 ]
Description:
Converts selected object (iObj) sizes to Cube panel sizes into given direction (iType).
So, the returned values can be directly assigned to Cube object in order to create
panel in exact direction.
iObj: selected object
iType direction: "XY", "YX", "XZ", "ZX", "YZ", "ZY"
[ Length, Width, Height ] = MagicPanels.sizesToCubePanel(obj, "YZ")
Returns [ Length, Width, Height ] for YZ object placement.
Description:
Allows to create Part, Plane, Body, Pad, Sketch objects.
iObj: object Cube to change into Pad
iPadLabel: Label for the new created Pad, the Name will be Pad
[ part, body, sketch, pad ] = MagicPanels.makePad(obj, "myPanel")
Created Pad with correct placement, rotation and return [ part, body, sketch, pad ].
Description:
Making holes.
iObj: base object to make hole
iFace: face of base object to make hole
iCylinders: list of cylinders to make holes below each one
holes = MagicPanels.makeHoles(obj, face, cylinders)
Make holes and return list of holes.
Description:
Making countersinks.
iObj: base object to drill
iFace: face of base object to drill
iCones: list of drill bits to drill below each one (Cone objects)
holes = MagicPanels.makeCountersinks(obj, face, cones)
Make holes and return list of holes.
Description:
Making counterbores.
iObj: base object to drill
iFace: face of base object to drill
iCones: list of drill bits to drill below each one (Cone objects)
holes = MagicPanels.makeCounterbores(obj, face, cones)
Make holes and return list of holes.
Description:
Making pocket holes for invisible connections.
iObj: base object to drill
iFace: face of base object to drill
iCones: list of drill bits to drill below each one (Cone objects)
holes = MagicPanels.makePocketHoles(obj, face, cones)
Make holes and return list of holes.
Description:
Making counterbores from both sides.
iObj: base object to drill
iFace: face of base object to drill
iCones: list of drill bits to drill below each one (Cone objects)
holes = MagicPanels.makeCounterbores2x(obj, face, cones)
Make holes and return list of holes.
Description:
Allows to create multi bool cut operation at given objects. First objects
from iObjects is the base element and all other will cut the base.
The copies will be created for cut.
iObjects: objects to parse by multi bool cut
cuts = MagicPanels.makeCuts(objects)
Array of cut objects will be returned.
Description:
Allows to create multi bool cut operation at given objects. First objects
from iObjects is the base element and all other will cut the base.
At this function version App::Link is used to create copy.
iObjects: objects to parse by multi bool cut
cuts = MagicPanels.makeCutsLinks(objects)
Array of cut objects will be returned.
Description:
Makes 45 frame cut with PartDesing Chamfer. For each face the ends will be cut.
iObjects: array of objects to cut
iFaces: dict() of faces for Chamfer cut direction, the key is iObjects value (object),
if there are more faces for object, the first one will be get as direction.
frames = MagicPanels.makeFrame45cut(objects, faces)
Created Frames with correct placement, rotation and return array with Chamfer frame objects.
Description:
Makes PartDesing Chamfer cut for edges array. But you can set different size for each edge.
Yes, you give edge objects, and you make chamfer for each edge, one by one, with different
size, but the most funny part is that the selected edge not exists because the Cube
object not exists ;-)
iObjects: array of objects to cut
iEdges: dict() of arrays [ edgeObj1, edgeObj2 ], edgeArr = iEdges[iObjects[0]]
iSizes: dict() of arrays [ 100, 50 ], sizeArr = iSizes[iObjects[0]]
iLabels: dict() of labels for new object, label = iLabels[iObjects[0]]
cuts = MagicPanels.makeChamferCut(objects, edges, sizes, labels)
return array with chamfer objects
Description:
Make Mortise pocket for given iSketch pattern.
iSketch: Sketch object as pattern for Mortise
iDepth: depth of the pocket
iPad: pad object to get Body
iFace: face object at the pad where is the iSketch
[ obj, face ] = MagicPanels.makeMortise(sketch, 20, obj, face)
Make Mortise and return new object and face reference for GUI info screen update and further processing
Description:
Make Tenon pad for given iSketch pattern.
iSketch: Sketch object as pattern for Mortise
iLength: Length for the Tenon pad
iPad: pad object to get Body
iFace: face object at the pad where is the iSketch
[ obj, face ] = MagicPanels.makeTenon(sketch, 20, obj, face)
Make Tenon and return new object and face reference for GUI info screen update and further processing
Description:
Allows to copy colors from iSource object to iTarget object.
iSource: source object
iTarget: target object
try:
MagicPanels.copyColors(panel, copy)
except:
skip = 1
All colors structure should be copied from source to target.
Description:
Allows to get key as letters for spreadsheet from given column and row index.
iC: column index
iR: row index
key = MagicPanels.sheetGetKey(1, 2)
return key string
Description:
Allows to show Gui info box for all available function and multiple calls.
iCaller: window title
iInfo: HTML text to show
iNote: additional tutorial ("yes" or "no"), by default is "yes".
info = "text to show"
iType = "XY"
MagicPanels.showInfo("window title", info)
MagicPanels.showInfo("window title", info, "no")
Show info Gui.