1) How can I meaure radius of circle or arc if I opened igs or stp data
2) How to view cross section of igs or stp data
Code: Select all
import Part
s=Gui.Selection.getSelectionEx()[0]
e=s.SubObjects[0]
if issubclass(type(e),Part.Edge):
if issubclass(type(e.Curve),Part.Circle):
print e.Curve.Radius
elif issubclass(type(e.Curve),Part.ArcOfCircle):
print e.Curve.Radius
What exactly do you mean?How to view cross section of igs or stp data
Code: Select all
import Part, math
def getPoint(e):
if issubclass(type(e),Part.Edge):
if issubclass(type(e.Curve),Part.Circle):
return e.Curve.Center
elif issubclass(type(e.Curve),Part.ArcOfCircle):
return e.Curve.Center
else:
raise Exception("Edge is not an arc or circle")
elif issubclass(type(e),Part.Vertex):
return e.Point
else:
raise Exception("Neither edge nor vertex selected")
selection = Gui.Selection.getSelectionEx()
if len(selection) >= 2:
e1 = selection[0].SubObjects[0]
e2 = selection[1].SubObjects[0]
elif len(selection) == 1:
e1 = selection[0].SubObjects[0]
e2 = selection[0].SubObjects[1]
else:
raise Exception("Wrong selection")
p1=getPoint(e1)
p2=getPoint(e2)
print ("Euclidian distance: %f") % (p1.distanceToPoint(p2))
print ("Delta x: %f") % (math.fabs(p1.x-p2.x))
print ("Delta y: %f") % (math.fabs(p1.y-p2.y))
print ("Delta z: %f") % (math.fabs(p1.z-p2.z))
Hi Wernerwmayer wrote:I don't think with the GUI it's already doable.