Correct placementFromDXFOCS()
Corrected placementFromDXFOCS() function with the indications provided by Autodesk (TM) http://docs.autodesk.com/ACD/2011/ITA/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7941.htm http://docs.autodesk.com/ACD/2011/ITA/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-793d.htm#WSc30cd3d5faa8f6d81cb25f1ffb755717d-7ff5
This commit is contained in:
@@ -785,7 +785,7 @@ def placementFromDXFOCS(ent):
|
||||
Parameters
|
||||
----------
|
||||
ent : A DXF entity
|
||||
It could be of several types, like `lwpolyline`, `polynine`,
|
||||
It could be of several types, like `lwpolyline`, `polyline`,
|
||||
and others, and with `ent.extrusion`, `ent.elevation`
|
||||
or `ent.loc` attributes.
|
||||
|
||||
@@ -802,6 +802,27 @@ def placementFromDXFOCS(ent):
|
||||
draftWPlane = FreeCAD.DraftWorkingPlane
|
||||
draftWPlane.alignToPointAndAxis(Vector(0.0, 0.0, 0.0),
|
||||
vec(ent.extrusion), 0.0)
|
||||
|
||||
# Riferimenti dell'algoritmo dell'asse arbitrario
|
||||
# http://docs.autodesk.com/ACD/2011/ITA/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7941.htm
|
||||
# http://docs.autodesk.com/ACD/2011/ITA/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-793d.htm#WSc30cd3d5faa8f6d81cb25f1ffb755717d-7ff5
|
||||
if (draftWPlane.axis == FreeCAD.Vector(1.0, 0.0, 0.0)):
|
||||
draftWPlane.u = FreeCAD.Vector(0.0, 1.0, 0.0)
|
||||
draftWPlane.v = FreeCAD.Vector(0.0, 0.0, 1.0)
|
||||
elif (draftWPlane.axis == FreeCAD.Vector(-1.0, 0.0, 0.0)):
|
||||
draftWPlane.u = FreeCAD.Vector(0.0, -1.0, 0.0)
|
||||
draftWPlane.v = FreeCAD.Vector(0.0, 0.0, 1.0)
|
||||
else:
|
||||
if ((abs(ent.extrusion[0]) < (1.0 / 64.0)) and (abs(ent.extrusion[1]) < (1.0 / 64.0))):
|
||||
draftWPlane.u = FreeCAD.Vector(0.0, 1.0, 0.0).cross(draftWPlane.axis)
|
||||
else:
|
||||
draftWPlane.u = FreeCAD.Vector(0.0, 0.0, 1.0).cross(draftWPlane.axis)
|
||||
draftWPlane.u.normalize()
|
||||
draftWPlane.v = draftWPlane.axis.cross(draftWPlane.u)
|
||||
draftWPlane.v.normalize()
|
||||
draftWPlane.position = Vector(0.0, 0.0, 0.0)
|
||||
draftWPlane.weak = False
|
||||
|
||||
pl = FreeCAD.Placement()
|
||||
pl = draftWPlane.getPlacement()
|
||||
if ((ent.type == "lwpolyline") or (ent.type == "polyline")):
|
||||
|
||||
Reference in New Issue
Block a user