北京网站建设 一流,建设手机银行的网站,重庆市官网首页,惠州百度seo在哪Python FreeCAD.Vector方法代码示例 本文整理汇总了Python中FreeCAD.Vector方法的典型用法代码示例。如果您正苦于以下问题#xff1a;Python FreeCAD.Vector方法的具体用法#xff1f;Python FreeCAD.Vector怎么用#xff1f;Python FreeCAD.Vector使用的例子#xff1f;那…Python FreeCAD.Vector方法代码示例 本文整理汇总了Python中FreeCAD.Vector方法的典型用法代码示例。如果您正苦于以下问题Python FreeCAD.Vector方法的具体用法Python FreeCAD.Vector怎么用Python FreeCAD.Vector使用的例子那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreeCAD的用法示例。
在下文中一共展示了FreeCAD.Vector方法的15个代码示例这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: doFlip ▲ 点赞 7 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def doFlip(obj, info, flipElement): if QtGui.QApplication.keyboardModifiers()QtCore.Qt.ControlModifier: rot FreeCAD.Rotation(FreeCAD.Vector(0,1,0),180) else: rot FreeCAD.Rotation(FreeCAD.Vector(1,0,0),180) rot FreeCAD.Placement(FreeCAD.Vector(), rot) FreeCAD.setActiveTransaction(Flip element if flipElement else Flip part)try:if flipElement:obj.Offset rot.multiply(obj.Offset)else:offset utils.getElementPlacement(obj.getSubObject())offset offset.multiply(rot).multiply(offset.inverse())setPlacement(info.Part, offset.multiply(info.Placement))obj.recompute(True)FreeCAD.closeActiveTransaction()except Exception:FreeCAD.closeActiveTransaction(True)raise 开发者ID:realthunder项目名称:FreeCAD_assembly3代码行数:23代码来源:assembly.py
示例2: make_profile_sketch ▲ 点赞 7 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def make_profile_sketch(self): import Sketcher sk FreeCAD.ActiveDocument.addObject(‘Sketcher::SketchObject’,‘Profile’) sk.Placement FreeCAD.Placement(FreeCAD.Vector(0,0,0),FreeCAD.Rotation(0,0,0,1)) sk.MapMode “Deactivated” sk.addGeometry(Part.LineSegment(FreeCAD.Vector(100.0,0.0,0),FreeCAD.Vector(127.0,12.0,0)),False) sk.addConstraint(Sketcher.Constraint(‘PointOnObject’,0,1,-1)) sk.addGeometry(Part.ArcOfCircle(Part.Circle(FreeCAD.Vector(125.0,17.0,0),FreeCAD.Vector(0,0,1),5.8),-1.156090,1.050925),False) sk.addConstraint(Sketcher.Constraint(‘Tangent’,0,2,1,1)) sk.addGeometry(Part.LineSegment(FreeCAD.Vector(128.0,22.0,0),FreeCAD.Vector(100.0,37.0,0)),False) sk.addConstraint(Sketcher.Constraint(‘Tangent’,1,2,2,1)) sk.addConstraint(Sketcher.Constraint(‘Vertical’,0,1,2,2)) sk.addConstraint(Sketcher.Constraint(‘DistanceY’,0,1,2,2,37.5)) sk.setDatum(4,FreeCAD.Units.Quantity(‘35.000000 mm’)) sk.renameConstraint(4, u’Lead’) sk.setDriving(4,False) sk.addConstraint(Sketcher.Constraint(‘Equal’,2,0)) FreeCAD.ActiveDocument.recompute() return sk 开发者ID:tomate44项目名称:CurvesWB代码行数:21代码来源:HelicalSweepFP.py
示例3: update_text ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def update_text(self): if self._shape is None: return p self.points[0] par self._shape.Curve.parameter(FreeCAD.Vector(p[0],p[1],p[2])) if self._text_type 0 : coords [‘{: 9.3f}’.format(par)] else: if par self._shape.FirstParameter: abscissa 0 else: c self._shape.Curve.trim(self._shape.FirstParameter, par) abscissa c.length() if self._text_type 1 : coords [‘{: 9.3f} mm’.format(abscissa)] elif self._text_type 2 : perc 100 * abscissa / self._shape.Length coords [‘{: 9.3f} %’.format(perc)] self._text_translate.translation p self._text.string.setValues(0,len(coords),coords) 开发者ID:tomate44项目名称:CurvesWB代码行数:22代码来源:splitCurves_2.py
示例4: set_tangents ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def set_tangents(self): #view_dir FreeCAD.Vector(0,0,1) view_dir FreeCADGui.ActiveDocument.ActiveView.getViewDirection() markers list() for o in self.root.selected_objects: if isinstance(o,MarkerOnShape): markers.append(o) elif isinstance(o,ConnectionLine): markers.extend(o.markers) if len(markers) 0: for m in markers: if m.tangent: m.tangent None else: i self.points.index(m) if i 0: m.tangent -view_dir else: m.tangent view_dir self.update_curve() 开发者ID:tomate44项目名称:CurvesWB代码行数:22代码来源:profile_editor.py
示例5: init ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def init(self, parent, dynamicFalse): super(CustomText, self).init(parent.points, dynamic) #self._text_offset FreeCAD.Vector(0,0,0) self._text_translate coin.SoTranslation() self._text_font coin.SoFont() self._text_font.name “Arial:Bold” self._text_font.size 13.0 self._text coin.SoText2() self._text_switch coin.SoSwitch() self._text_switch.addChild(self._text_translate) self._text_switch.addChild(self._text_font) self._text_switch.addChild(self._text) self.addChild(self._text_switch) self.parent parent self.parent.on_drag.append(self.translate) self.translate() 开发者ID:tomate44项目名称:CurvesWB代码行数:18代码来源:manipulators.py
示例6: execute ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def execute(self, obj): s1 obj.Shape1.Shape s2 obj.Shape2.Shape if obj.Direction1.Length 1e-7: d1 obj.Shape1.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1)) else: d1 obj.Direction1 if obj.Direction2.Length 1e-7: d2 obj.Shape2.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1)) else: d2 obj.Direction2 cc CombinedProjectionCurve(s1,s2,d1,d2) if hasattr(obj,“ExtensionProxy”): obj.Shape obj.ExtensionProxy.approximate(obj,cc.shape().Edges) else: obj.Shape cc.shape() 开发者ID:tomate44项目名称:CurvesWB代码行数:18代码来源:combined_curve.py
示例7: Activated ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def Activated(self): vd [FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,0)] try: sel FreeCADGui.activeWorkbench().Selection vd FreeCADGui.activeWorkbench().View_Directions except AttributeError: sel FreeCADGui.Selection.getSelectionEx() if not len(sel) 2: FreeCAD.Console.PrintError(“Select 2 objects !\n”) return for selobj in sel: selobj.Object.ViewObject.Visibility False if len(vd) 2 and vd[0].dot(vd[1]) 0.999: d1, d2 vd else: d1,d2 [FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,0)] self.makeCPCFeature(sel[0].Object,sel[1].Object,d1,d2) 开发者ID:tomate44项目名称:CurvesWB代码行数:19代码来源:combined_curve.py
示例8: execute ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def execute(self, obj): s1 obj.Shape1.Shape s2 obj.Shape2.Shape if obj.Direction1.Length 1e-7: d1 obj.Shape1.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1)) else: d1 obj.Direction1 if obj.Direction2.Length 1e-7: d2 obj.Shape2.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1)) else: d2 obj.Direction2 cc MixedCurve(s1,s2,d1,d2) if hasattr(obj,“ExtensionProxy”): obj.Shape obj.ExtensionProxy.approximate(obj,cc.shape().Edges) else: obj.Shape cc.shape() 开发者ID:tomate44项目名称:CurvesWB代码行数:18代码来源:mixed_curve.py
示例9: subdivide ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def subdivide(self): # get selected lines and subdivide them pts list() new_select list() for o in self.lines: #FreeCAD.Console.PrintMessage(“object %s\n”%str(o)) if isinstance(o,ConnectionLine): pts.append(o.markers[0]) if o in self.root.selected_objects: idx self.lines.index(o) FreeCAD.Console.PrintMessage(“Subdividing line #%d\n”%idx) p1 o.markers[0].points[0] p2 o.markers[1].points[0] par1 self.curve.parameter(FreeCAD.Vector(p1)) par2 self.curve.parameter(FreeCAD.Vector(p2)) midpar (par1par2)/2.0 mark MarkerOnShape([self.curve.value(midpar)]) pts.append(mark) new_select.append(mark) pts.append(self.points[-1]) self.points pts self.setup_InteractionSeparator() self.root.selected_objects new_select self.update_curve() return(True) 开发者ID:tomate44项目名称:CurvesWB代码行数:27代码来源:blendsurf_editor.py
示例10: execute ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def execute(self, obj): debug(“* Hook : execute *\n”) e self.getEdge(obj) if e None: return #center FreeCAD.Vector(0,0,0) if obj.Method “Fixed”: p FreeCAD.Vector(obj.X, obj.Y, obj.Z) v Part.Vertex§ obj.Center v.distToShape(e)[1][0][1] elif obj.Method “Parameter”: obj.Center e.valueAt(obj.Parameter) elif obj.Method “Distance-From-Start”: par e.getParameterByLength(obj.StartDistance) obj.Center e.valueAt(par) elif obj.Method “Distance-From-End”: par e.getParameterByLength(e.Length - obj.EndDistance) obj.Center e.valueAt(par) #radius 1.0 * e.Length / 100.0 #sphere Part.Sphere() #sphere.Radius radius #sphere.Center obj.Center obj.Shape Part.Vertex(obj.Center) 开发者ID:tomate44项目名称:CurvesWB代码行数:25代码来源:hooks.py
示例11: Activated ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def Activated(self): self.view FreeCADGui.ActiveDocument.ActiveView self.viewer self.view.getViewer() self.oldRadius self.viewer.getPickRadius() self.viewer.setPickRadius(25.0) self.obj FreeCAD.ActiveDocument.addObject(Part::Spline,BSplineCurve)self.stack [FreeCAD.Vector(0,0,0)]self.markerPos Noneself.snap Falseself.snapShape Noneself.point FreeCAD.Vector(0,0,0)self.curve Part.BSplineCurve()self.degree 1self.mults [2,2]self.knots [0.]self.clicCB self.view.addEventCallbackPivy( coin.SoMouseButtonEvent.getClassTypeId(), self.clic_cb)self.keyboardCB self.view.addEventCallbackPivy( coin.SoKeyboardEvent.getClassTypeId(), self.kb_cb)self.cursorCB self.view.addEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), self.cursor_cb)self.nodeInit()for st in self.info:FreeCAD.Console.PrintError(st\n) 开发者ID:tomate44项目名称:CurvesWB代码行数:27代码来源:bezierCurve.py
示例12: join_curve ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def join_curve(c1,c2): c Part.BSplineCurve() # poles (sequence of Base.Vector), [mults , knots, periodic, degree, weights (sequence of float), CheckRational] new_poles c1.getPoles() new_poles.extend(c2.getPoles()[1:]) new_weights c1.getWeights() new_weights.extend(c2.getWeights()[1:]) new_mults c1.getMultiplicities()[:-1] new_mults.append(c1.Degree) new_mults.extend(c2.getMultiplicities()[1:]) knots1 c1.getKnots() knots2 [knots1[-1] k for k in c2.getKnots()] new_knots knots1 new_knots.extend(knots2[1:]) print(“poles - %r”%new_poles) print(“weights - %r”%new_weights) print(“mults - %r”%new_mults) print(“knots - %r”%new_knots) c.buildFromPolesMultsKnots(new_poles, new_mults, new_knots, False, c1.Degree, new_weights, True) return c 开发者ID:tomate44项目名称:CurvesWB代码行数:22代码来源:nurbs_tools.py
示例13: Activated ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def Activated(self): self.view FreeCADGui.ActiveDocument.ActiveView self.viewer self.view.getViewer() self.oldRadius self.viewer.getPickRadius() self.viewer.setPickRadius(15.0) self.obj FreeCAD.ActiveDocument.addObject(“Part::Feature”,“BezierCurve”) self.stack [FreeCAD.Vector(0,0,0)] self.markerPos None self.snap False self.snapShape None self.point FreeCAD.Vector(0,0,0) self.curve Part.BezierCurve() self.clicCB self.view.addEventCallbackPivy( coin.SoMouseButtonEvent.getClassTypeId(), self.clic_cb) self.keyboardCB self.view.addEventCallbackPivy( coin.SoKeyboardEvent.getClassTypeId(), self.kb_cb) self.cursorCB self.view.addEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), self.cursor_cb) FreeCADGui.Selection.clearSelection() FreeCADGui.Selection.addObserver(self) self.nodeInit() 开发者ID:tomate44项目名称:CurvesWB代码行数:20代码来源:bezierCurve-selection.py
示例14: init ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def init(self, obj, src): “”“Add the properties”“” obj.addProperty(“App::PropertyLink”, “Source”, “ReflectLines”, “Source object”) obj.addProperty(“App::PropertyLinkSubList”,“IndivFaces”,“ReflectLines”, “Individual faces”) obj.addProperty(“App::PropertyVector”, “ViewPos”, “ReflectLines”, “View position”) obj.addProperty(“App::PropertyVector”, “ViewDir”, “ReflectLines”, “View direction”) obj.addProperty(“App::PropertyVector”, “UpDir”, “ReflectLines”, “Up direction”) obj.addProperty(“App::PropertyBool”, “ShapeCleaning”,“ReflectLines”, “Remove duplicate edges”).ShapeCleaning False obj.addProperty(“App::PropertyInteger”, “Samples”,“CleaningOptions”, “Number of edge samples”).Samples 10 obj.addProperty(“App::PropertyQuantity”, “Tolerance”,“CleaningOptions”, “Tolerance for duplicate detection”).Tolerance 1e-3 #obj.Samples [10,3,999,1] obj.ViewPos FreeCAD.Vector(0,0,0) obj.ViewDir FreeCAD.Vector(0,0,1) obj.UpDir FreeCAD.Vector(0,1,0) obj.setEditorMode(“Samples”,2) obj.setEditorMode(“Tolerance”,2) if isinstance(src,(list,tuple)): obj.IndivFaces src else: obj.Source src obj.Proxy self 开发者ID:tomate44项目名称:CurvesWB代码行数:23代码来源:ReflectLinesFP.py
示例15: Activated ▲ 点赞 6 ▼
需要导入模块: import FreeCAD [as 别名]
或者: from FreeCAD import Vector [as 别名]
def Activated(self): self.view FreeCADGui.ActiveDocument.ActiveView self.viewer self.view.getViewer() self.oldRadius self.viewer.getPickRadius() self.viewer.setPickRadius(15.0) self.obj FreeCAD.ActiveDocument.addObject(“Part::Feature”,“BezierCurve”) #FreeCAD.ActiveDocument.recompute() #self.obj.ViewObject.Selectable False self.stack [FreeCAD.Vector(0,0,0)] self.markerPos None self.snap False self.snapShape None self.point FreeCAD.Vector(0,0,0) self.curve Part.BezierCurve() self.clicCB self.view.addEventCallbackPivy( coin.SoMouseButtonEvent.getClassTypeId(), self.clic_cb) self.keyboardCB self.view.addEventCallbackPivy( coin.SoKeyboardEvent.getClassTypeId(), self.kb_cb) self.cursorCB self.view.addEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), self.cursor_cb) #FreeCADGui.Selection.clearSelection() #FreeCADGui.Selection.addObserver(self) self.nodeInit() 文章转载自: http://www.morning.jfmyt.cn.gov.cn.jfmyt.cn http://www.morning.frsxt.cn.gov.cn.frsxt.cn http://www.morning.fbpdp.cn.gov.cn.fbpdp.cn http://www.morning.ckdgj.cn.gov.cn.ckdgj.cn http://www.morning.pjtw.cn.gov.cn.pjtw.cn http://www.morning.dhpjq.cn.gov.cn.dhpjq.cn http://www.morning.hcqpc.cn.gov.cn.hcqpc.cn http://www.morning.pxjp.cn.gov.cn.pxjp.cn http://www.morning.mhwtq.cn.gov.cn.mhwtq.cn http://www.morning.kwnbd.cn.gov.cn.kwnbd.cn http://www.morning.ydnxm.cn.gov.cn.ydnxm.cn http://www.morning.ldgqh.cn.gov.cn.ldgqh.cn http://www.morning.qpntn.cn.gov.cn.qpntn.cn http://www.morning.wpqwk.cn.gov.cn.wpqwk.cn http://www.morning.mkrqh.cn.gov.cn.mkrqh.cn http://www.morning.brld.cn.gov.cn.brld.cn http://www.morning.nkbfc.cn.gov.cn.nkbfc.cn http://www.morning.zkbxx.cn.gov.cn.zkbxx.cn http://www.morning.nzqqd.cn.gov.cn.nzqqd.cn http://www.morning.mjzcp.cn.gov.cn.mjzcp.cn http://www.morning.egmux.cn.gov.cn.egmux.cn http://www.morning.smrty.cn.gov.cn.smrty.cn http://www.morning.gmmxh.cn.gov.cn.gmmxh.cn http://www.morning.lxjcr.cn.gov.cn.lxjcr.cn http://www.morning.csnch.cn.gov.cn.csnch.cn http://www.morning.kmqms.cn.gov.cn.kmqms.cn http://www.morning.sgnxl.cn.gov.cn.sgnxl.cn http://www.morning.hlnrj.cn.gov.cn.hlnrj.cn http://www.morning.bmyrl.cn.gov.cn.bmyrl.cn http://www.morning.slfmp.cn.gov.cn.slfmp.cn http://www.morning.nxzsd.cn.gov.cn.nxzsd.cn http://www.morning.wjjxr.cn.gov.cn.wjjxr.cn http://www.morning.rykgh.cn.gov.cn.rykgh.cn http://www.morning.wbyqy.cn.gov.cn.wbyqy.cn http://www.morning.kqgqy.cn.gov.cn.kqgqy.cn http://www.morning.kfjnx.cn.gov.cn.kfjnx.cn http://www.morning.ynrzf.cn.gov.cn.ynrzf.cn http://www.morning.yzygj.cn.gov.cn.yzygj.cn http://www.morning.chmkt.cn.gov.cn.chmkt.cn http://www.morning.mwns.cn.gov.cn.mwns.cn http://www.morning.jyjqh.cn.gov.cn.jyjqh.cn http://www.morning.nkcfh.cn.gov.cn.nkcfh.cn http://www.morning.cwskn.cn.gov.cn.cwskn.cn http://www.morning.hctgn.cn.gov.cn.hctgn.cn http://www.morning.rdtp.cn.gov.cn.rdtp.cn http://www.morning.mdlqf.cn.gov.cn.mdlqf.cn http://www.morning.smsjx.cn.gov.cn.smsjx.cn http://www.morning.dgpxp.cn.gov.cn.dgpxp.cn http://www.morning.lpzyq.cn.gov.cn.lpzyq.cn http://www.morning.kjlia.com.gov.cn.kjlia.com http://www.morning.mwnch.cn.gov.cn.mwnch.cn http://www.morning.cgstn.cn.gov.cn.cgstn.cn http://www.morning.cdrzw.cn.gov.cn.cdrzw.cn http://www.morning.ktqtf.cn.gov.cn.ktqtf.cn http://www.morning.pffqh.cn.gov.cn.pffqh.cn http://www.morning.scrnt.cn.gov.cn.scrnt.cn http://www.morning.pcqdf.cn.gov.cn.pcqdf.cn http://www.morning.rwbx.cn.gov.cn.rwbx.cn http://www.morning.qyxnf.cn.gov.cn.qyxnf.cn http://www.morning.tgyzk.cn.gov.cn.tgyzk.cn http://www.morning.ffbl.cn.gov.cn.ffbl.cn http://www.morning.nsncq.cn.gov.cn.nsncq.cn http://www.morning.mytmx.cn.gov.cn.mytmx.cn http://www.morning.pjrgb.cn.gov.cn.pjrgb.cn http://www.morning.rkypb.cn.gov.cn.rkypb.cn http://www.morning.xppj.cn.gov.cn.xppj.cn http://www.morning.jfwbr.cn.gov.cn.jfwbr.cn http://www.morning.tsdqr.cn.gov.cn.tsdqr.cn http://www.morning.nrcbx.cn.gov.cn.nrcbx.cn http://www.morning.rbkgp.cn.gov.cn.rbkgp.cn http://www.morning.qfths.cn.gov.cn.qfths.cn http://www.morning.qfdyt.cn.gov.cn.qfdyt.cn http://www.morning.wtdhm.cn.gov.cn.wtdhm.cn http://www.morning.qsmch.cn.gov.cn.qsmch.cn http://www.morning.ysfj.cn.gov.cn.ysfj.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.ljbm.cn.gov.cn.ljbm.cn http://www.morning.ljcjc.cn.gov.cn.ljcjc.cn http://www.morning.cxtbh.cn.gov.cn.cxtbh.cn http://www.morning.gkmwk.cn.gov.cn.gkmwk.cn