Code: Select all
>>> sphere = Part.makeSphere(10)
>>> plane = Part.makePlane(100,100)
>>> projection = plane.project([sphere])
>>> projection.Wires
[]
Code: Select all
>>> sphere = Part.makeSphere(10)
>>> plane = Part.makePlane(100,100)
>>> projection = plane.project([sphere])
>>> projection.Wires
[]
Code: Select all
projection.Edges
Code: Select all
>>> projection.Edges
[<Edge object at 000001AAECF828A0>, <Edge object at 000001AAECF84A20>]
>>> projection.Edges[0].BoundBox
BoundBox (0, 0, 0, 3.06162e-15, 4.49928e-31, 0)
>>> projection.Edges[1].BoundBox
BoundBox (0, 0, 0, 3.06162e-15, 4.49928e-31, 0)
Code: Select all
box = Part.makeBox(10,5,2)
plane = Part.makePlane(100,100)
projection = plane.project([box])
projection.Edges[2].BoundBox
Code: Select all
box = App.ActiveDocument.addObject("Part::Box","Box")
box.Placement = App.Placement(App.Vector(0,0,20),App.Rotation(App.Vector(0.29582,-0.714173,-0.634388),66))
plane = App.ActiveDocument.addObject("Part::Plane","Plane")
plane.Length=60.00
plane.Width=60.00
plane.Placement=App.Placement(App.Vector(-30.00,-30.00,0.00),App.Rotation(App.Vector(0.00,0.00,1.00),0.00))
plane.ViewObject.Transparency=80
App.ActiveDocument.recompute()
proj = plane.Shape.project([box.Shape])
Part.show(proj)
App.ActiveDocument.recompute()
Code: Select all
sph = App.ActiveDocument.addObject("Part::Sphere","Sphere")
sph.Placement = App.Placement(App.Vector(0,0,20),App.Rotation(App.Vector(0,0,1),0))
plane = App.ActiveDocument.addObject("Part::Plane","Plane")
plane.Length=60.00
plane.Width=60.00
plane.Placement=App.Placement(App.Vector(-30.00,-30.00,0.00),App.Rotation(App.Vector(0.00,0.00,1.00),0.00))
plane.ViewObject.Transparency=80
App.ActiveDocument.recompute()
proj = plane.Shape.project([sph.Shape])
Part.show(proj)
App.ActiveDocument.recompute()
Code: Select all
sph = App.ActiveDocument.addObject("Part::Sphere","Sphere")
sph.Placement = App.Placement(App.Vector(0,0,20),App.Rotation(App.Vector(1,0,0),90))
plane = App.ActiveDocument.addObject("Part::Plane","Plane")
plane.Length=60.00
plane.Width=60.00
plane.Placement=App.Placement(App.Vector(-30.00,-30.00,0.00),App.Rotation(App.Vector(0.00,0.00,1.00),0.00))
plane.ViewObject.Transparency=80
App.ActiveDocument.recompute()
proj = plane.Shape.project([sph.Shape])
Part.show(proj)
App.ActiveDocument.recompute()
Code: Select all
e0,e1,e2 = sph.Shape.Edges
e0.BoundBox
# BoundBox (3.06162e-16, -7.4988e-32, 25, 3.06162e-16, -7.4988e-32, 25)
e1.BoundBox
# BoundBox (3.06162e-16, -1.22465e-15, 15, 5, -7.4988e-32, 25)
e2.BoundBox
# BoundBox (3.06162e-16, -7.4988e-32, 15, 3.06162e-16, -7.4988e-32, 15)
Code: Select all
e1.Curve
#Circle (Radius : 5, Position : (0, 0, 20), Direction : (-2.44929e-16, -2.22045e-16, -1))
Code: Select all
e0.Curve
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: undefined curve type
Code: Select all
<Methode Name="makeParallelProjection" Const="true">
<Documentation>
<UserDocu>Parallel projection of an edge or wire on this shape
makeParallelProjection(shape, dir) -> Shape
</UserDocu>
Code: Select all
# include <BRepProj_Projection.hxx>
and
# include <BRepAlgo_NormalProjection.hxx>
An edge is a topological wrapper around one, or more, geometry curves.
Code: Select all
sphere = Part.makeSphere(10)
# The 3D curve is undefined
sphere.Edge1.Curve
# Its length is 0
sphere.Edge1.Length
# Does it have a p-curve ?
curve2d, surface, placement, first_param, last_param = sphere.Edge1.curveOnSurface(0)
print("{} on {}".format(curve2d, surface))
# It is a 2D line on a Spherical surface
# What are the endpoints of this line ?
curve2d.value(first_param)
curve2d.value(last_param)
Code: Select all
sphere.Edge2.Curve
sphere.Edge2.Length
# This edge has a valid 3D curve
# Does it have also p-curves ?
curve2d, surface, placement, first_param, last_param = sphere.Edge2.curveOnSurface(0)
print("{} on {}".format(curve2d, surface))
curve2d.value(first_param)
curve2d.value(last_param)
# this edge corresponds to the right vertical edge of the square
# Does it have another p-curve ?
curve2d, surface, placement, first_param, last_param = sphere.Edge2.curveOnSurface(1)
print("{} on {}".format(curve2d, surface))
curve2d.value(first_param)
curve2d.value(last_param)
# So this edge is also the representation of the left vertical edge of the square
Code: Select all
sphere.Edge3.Curve
sphere.Edge3.Length
curve2d, surface, placement, first_param, last_param = sphere.Edge3.curveOnSurface(0)
print("{} on {}".format(curve2d, surface))
curve2d.value(first_param)
curve2d.value(last_param)
wmayer wrote: Ping
uwestoehr wrote: Ping
aapo wrote: Ping
Code: Select all
sphere.Faces[0] .ParameterRange
Code: Select all
sphere = Part.makeSphere(10)
sphere.Faces[0] .ParameterRange
# ---> (0.0, 6.283185307179586, -1.5707963267948966, 1.5707963267948966)