本文整理汇总了Python中Wrappers.make_vertex方法的典型用法代码示例。如果您正苦于以下问题:Python Wrappers.make_vertex方法的具体用法?Python Wrappers.make_vertex怎么用?Python Wrappers.make_vertex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wrappers
的用法示例。
在下文中一共展示了Wrappers.make_vertex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: displayPixelGrid
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
def displayPixelGrid(pixelGrid):
"show all the points in a pixel grid"
l = [];
for k in pixelGrid.keys():
l.append(Wrappers.make_vertex(gp.gp_Pnt(k[0],k[1],0.00)));
display.DisplayShape(l);
示例2: makeEdgeIndicator
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
def makeEdgeIndicator(edge):
"makes an indicator showing which way the edge goes"
ew = Wrappers.Edge(edge);
fp = ew.firstParameter;
lp = ew.lastParameter;
if ew.reversed:
p = fp + (( lp - fp ) * 1 / 5 );
else:
p = fp + ((lp - fp) * 4 /5 );
midPnt = ew.curve.Value(p);
return Wrappers.make_vertex(midPnt);
示例3: splitPerfTest
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
def splitPerfTest():
"make a long wire of lots of edges"
"""
performance of the wire split routine is surprisingly bad!
"""
WIDTH=0.1
edges = [];
#trick here. after building a wire, the edges change identity.
#evidently, BRepBuilder_MakeWire makes copies of the underliying edges.
h = hexagonlib.Hexagon(2.0,0 );
wirelist = h.makeHexForBoundingBox((0,0,0), (100,100,0));
w = wirelist[0];
ee = Wrappers.Wire(w).edgesAsList();
TestDisplay.display.showShape(w);
#compute two intersections
e1 = Wrappers.Edge(ee[5]);
e2 = Wrappers.Edge(ee[60]);
e1p = (e1.lastParameter - e1.firstParameter )/ 2;
e2p = (e2.lastParameter - e2.firstParameter )/ 2;
p1 = PointOnAnEdge(e1.edge,e1p ,e1.pointAtParameter(e1p));
p2 = PointOnAnEdge(e2.edge,e2p ,e2.pointAtParameter(e2p));
TestDisplay.display.showShape( Wrappers.make_vertex(p1.point));
TestDisplay.display.showShape( Wrappers.make_vertex(p2.point));
cProfile.runctx('for i in range(1,2): ee=splitWire(w,[p2,p1])', globals(), locals(), filename="slicer.prof")
p = pstats.Stats('slicer.prof')
p.sort_stats('cum')
p.print_stats(.98);
t = Wrappers.Timer();
ee = None;
for i in range(1,2):
ee = splitWire(w,[p2,p1]);
print "Elapsed for 100splits:",t.finishedString();
示例4: testProjectingPointInaccurately
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
def testProjectingPointInaccurately():
"""
test projecting a point onto a curve
"""
h = makeHeartWire()
# convert to twod curves
curves = []
for e in Wrappers.Wire(h).edges2():
curves.append(get2dCurveFrom3dEdge(e))
# project a point onto the wire. we want to see if slight inaccurcies will project.
# this simulates trying to find points on a curve that were put there via pixels
display.DisplayShape(h)
DISTANCE = 0.004
p = gp.gp_Pnt2d(2.0 + DISTANCE, 2.0 - DISTANCE)
display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(), p.Y(), 0)))
for c in curves:
r = projectPointOnCurve2d(c, p, 0.005)
if r is not None:
(param, pnt) = r
print "found point: parmater-%0.3f, point-(%0.3f,%0.3f)" % (param, pnt.X(), pnt.Y())
display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(pnt.X(), pnt.Y(), 0)))
示例5:
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
#TestDisplay.display.showShape(testWire);
resultEdge = TopoDS.TopoDS_Edge();
#try to get edge from paramter
p = 0.5;
eP = curve.Edge(p,resultEdge);
print "CompCurve Parameter %0.2f = edge parameter %0.2f" % ( p, eP) ;
TestDisplay.display.showShape(resultEdge);
#show the selected point also
point = curve.Value(p);
#get all of the intervals for the wire
print "Getting %d Intervals" % nB;
array = TColStd.TColStd_Array1OfReal(1,nB+2);
curve.Intervals(array,2);
print "Bounding Parameters: ",listFromArray(array);
TestDisplay.display.showShape(Wrappers.make_vertex(point));
wr = Wrappers.Wire(testWire);
edgeList = []
for e in wr.edges2():
edgeList.append(e);
print "Edges:",edgeList
TestDisplay.display.run();
示例6: findIntersectionsUsingCurvesNoSorting
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import make_vertex [as 别名]
# flatten all of these edges into one list
# allHexLines = []
# for a in hexarray:
# allHexLines.extend(a);
# fine all intersections using curves directly, with no sorting or boudning boxes
# q = time.clock();
# (count,ipoints) = findIntersectionsUsingCurvesNoSorting(h3,fillCurves);
# print ("Computed %d intersections in %0.3f: %d intersections found" ) % ( count, (time.clock() - q),len(ipoints));
q = time.clock()
# (count,ipoints) = findIntersectionsUsingCurves(h3,fillCurves);
(count, ipoints) = findIntersectionsUsingCurvesNoSorting(h2, fillCurves)
print ("Computed %d intersections in %0.3f: %d intersections found") % (count, (time.clock() - q), len(ipoints))
for p in ipoints:
display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(), p.Y(), 0)), update=False)
# annoying-- no 2d vertex exists really
# display wire
print "Done"
# for p in ipoints:
# display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(),p.Y(),0)) ,update=False );
# displayCurveList(fillCurves);
# for w in fillWires:
# TestDisplay.display.showShape(w);
# display.DisplayShape(h3);
display.FitAll()
# TestDisplay.display.showShape(offset2dWire(h,-0.1))
start_display()