Vector math utilities used in Draft workbench. More...

Namespaces

 importAirfoilDAT
 Airfoil (.dat) file importer.
 

Functions

def DraftVecUtils.angle (u, v=Vector(1, 0, 0), normal=Vector(0, 0, 1))
 
def DraftVecUtils.closest (vector, vlist)
 
def DraftVecUtils.dist (u, v)
 
def DraftVecUtils.equals (u, v)
 
def DraftVecUtils.find (vector, vlist)
 
def DraftVecUtils.getPlaneRotation (u, v, w=None)
 
def DraftVecUtils.getRotation (vector, reference=Vector(1, 0, 0))
 
def DraftVecUtils.isColinear (vlist)
 
def DraftVecUtils.isNull (vector)
 
def DraftVecUtils.neg (u)
 
def DraftVecUtils.precision ()
 
def DraftVecUtils.project (u, v)
 
def DraftVecUtils.removeDoubles (vlist)
 
def DraftVecUtils.rotate (u, angle, axis=Vector(0, 0, 1))
 
def DraftVecUtils.rotate2D (u, angle)
 
def DraftVecUtils.rounded (v)
 
def DraftVecUtils.scale (u, scalar)
 
def DraftVecUtils.scaleTo (u, l)
 
def DraftVecUtils.toString (u)
 
def DraftVecUtils.tup (u, array=False)
 
def DraftVecUtils.typecheck (args_and_types, name="?")
 

Variables

 DraftVecUtils.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
 

Detailed Description

Vector math utilities used in Draft workbench.

Vector math utilities

Function Documentation

def DraftVecUtils.angle (   u,
  v = Vector(1,0,0),
  normal = Vector(0,0,1) 
)
    angle(Vector,[Vector],[Vector]) - returns the angle
    in radians between the two vectors. If only one is given,
    angle is between the vector and the horizontal East direction.
If a third vector is given, it is the normal used to determine
    the sign of the angle.

Referenced by DraftTools.Offset.action(), Sketcher::Sketch.addAngleAtPointConstraint(), importDXF.addText(), PartGui::DimensionAngular.affectsState(), DraftGeomUtils.angleBisection(), CmdSketcherConstrainPerpendicular.applyConstraint(), importSVG.arcend2center(), PartGui::ArcEngine.ArcEngine(), DraftGui.DraftToolBar.changeAngleValue(), DraftGeomUtils.circleFrom2LinesRadius(), PartDesignGui::TaskThicknessParameters.clearButtons(), importIFC.createCurve(), DraftTools.Rectangle.createObject(), PartGui::DimensionAngular.DimensionAngular(), DraftGui.DraftToolBar.displayPoint(), Part::TopoShapePy.distToShape(), SketcherGui::ViewProviderSketch.doBoxSelection(), TechDrawGui::QGIViewDimension.draw(), SketcherGui::ViewProviderSketch.draw(), TechDrawGeometry::Ellipse.Ellipse(), PartGui::ArcEngine.evaluate(), PartDesign::Boolean.execute(), Part::Revolution.execute(), PartDesign::Groove.execute(), PartDesign::Revolution.execute(), PartDesign::Pad.execute(), Drawing::SVGOutput.exportEdges(), Drawing::DXFOutput.exportEdges(), DraftGeomUtils.findDistance(), SketcherGui::SoDatumLabel.generatePrimitives(), Base::VectorPy.getAngle(), Base::RotationPy.getAngle(), DraftTrackers.arcTracker.getAngle(), importDXF.getArcData(), Span.GetArea(), Base::RotationPy.getAxis(), DraftGeomUtils.getCubicDimensions(), WorkingPlane.plane.getDeviation(), importIFClegacy.getIfcExtrusionData(), Path::Toolpath.getLength(), PartDesignGui::TaskDraftParameters.getLine(), Part::FeatureReference.getLocation(), Part::Feature.getLocation(), importIFC.getRepresentation(), TechDraw::DrawProjGroupItem.getRotateAngle(), FCSphereSheetProjector.getRotation(), DraftGeomUtils.getRotation(), Part::TopoShape.getShape(), Draft.getSVG(), PartDesign::PolarPattern.getTransformations(), importIFClegacy.getTuples(), Part::Revolution.getViewProviderName(), SketcherGui::SoDatumLabel.GLRender(), PartGui.goDimensionAngularNoTask(), TechDraw::incidenceItem.incidenceItem(), geoff_geometry.IncludedAngle(), DraftGeomUtils.isClockwise(), DraftVecUtils.isColinear(), geoff_geometry::Span.JoinSeparateSpans(), TechDrawGui::QGISectionLine.makeArrows(), Draft.makeCircle(), TechDraw::DrawGeomHatch.makeEdgeOverlay(), TechDraw::EdgeWalker.makeEmbedding(), ArchRoof.makeRoof(), Draft.makeSketch(), DrawSketchHandlerLine.mouseMove(), DrawSketchHandlerLineSet.mouseMove(), DrawSketchHandlerCopy.mouseMove(), DrawSketchHandlerArc.mouseMove(), DrawSketchHandlerRectangularArray.mouseMove(), DrawSketchHandler3PointArc.mouseMove(), DrawSketchHandlerCircle.mouseMove(), DrawSketchHandlerArcOfEllipse.mouseMove(), DrawSketchHandlerArcOfHyperbola.mouseMove(), DrawSketchHandlerArcOfParabola.mouseMove(), DrawSketchHandlerBSpline.mouseMove(), DrawSketchHandler3PointCircle.mouseMove(), DrawSketchHandlerSlot.mouseMove(), DrawSketchHandlerRegularPolygon.mouseMove(), SketcherGui::ViewProviderSketch.moveConstraint(), MeshPart::MeshAlgos.offsetSpecial2(), Mesh::MeshObject.offsetSpecial2(), DraftGeomUtils.offsetWire(), Gui::Dialog::DemoMode.on_angleSlider_valueChanged(), geoff_geometry::Matrix.operator!=(), geoff_geometry::Circle.operator!=(), DraftGeomUtils.orientEdge(), Base::RotationPy.PyInit(), Base::PlacementPy.PyInit(), DraftTools.Trimex.redraw(), DrawSketchHandlerFillet.releaseButton(), Part::GeometryPy.rotate(), Part::Geometry2dPy.rotate(), Part::TopoShapePy.rotate(), MeshCore::MeshOutput.SaveX3D(), SketcherGui::DrawSketchHandler.seekAutoConstraint(), GraphicsViewZoom.set_zoom_factor_base(), Base::RotationPy.setAngle(), Base::RotationPy.setAxis(), Gui::Dialog::Placement.setPlacement(), importIFC.setRepresentation(), Base::Rotation.setValue(), Base::Rotation.slerp(), Gui::SoFCCSysDragger.SoFCCSysDragger(), SoGestureSwipeEvent.SoGestureSwipeEvent(), FemGui::TaskFemConstraintGear.TaskFemConstraintGear(), PartDesignGui::TaskPolarPatternParameters.TaskPolarPatternParameters(), Gui::PropertyEditor::PropertyPlacementItem.toolTip(), Gui::PropertyEditor::PropertyPlacementItem.toString(), DraftTools.Trimex.trimObjects(), FemGui::ViewProviderFemConstraintGear.updateData(), PathGui::ViewProviderPath.updateData(), Gui::PropertyEditor::PropertyPlacementItem.value(), MeshGui::ViewProviderMesh.ViewProviderMesh(), Part::TopoShapePy.writeInventor(), Part::Module.~Module(), Gui::PropertyEditor::PlacementEditor.~PlacementEditor(), and Gui::PropertyEditor::PropertyPlacementItem.~PropertyPlacementItem().

def DraftVecUtils.closest (   vector,
  vlist 
)
closest(vector,vlist): finds the closest vector to the given vector
in a list of vectors

Referenced by Base::BoundBox3< _Precision >.ClosestPoint(), DraftGeomUtils.connect(), SketcherGui::ViewProviderSketch.drawMergedConstraintIcons(), and DraftTools.Trimex.trimObjects().

def DraftVecUtils.dist (   u,
  v 
)

Referenced by DraftTools.Arc.action(), DraftTools.Polygon.action(), DraftTools.Rotate.action(), PartGui::CrossSections.apply(), CmdSketcherConstrainPerpendicular.applyConstraint(), Drawing::DrawingOutput.asCircle(), Attacher::AttachEngineLine.calculateAttachedPlacement(), CArea.ChangeStartToNearest(), DraftGeomUtils.circlefrom1Line2Points(), DraftGeomUtils.circleFrom2PointsRadius(), DraftGeomUtils.circleFromPointLineRadius(), DraftGeomUtils.circleInversion(), ConstraintItem.data(), geoff_geometry.Dist(), Base::VectorPy.distanceToLine(), Base::Vector3< _Precision >.DistanceToLineSegment(), Base::VectorPy.distanceToPlane(), Base::VectorPy.distanceToPoint(), GCS::ConstraintP2PDistance.error(), GCS::ConstraintP2LDistance.error(), Mesh::SegmentByMesh.execute(), DraftGeomUtils.findRadicalAxis(), TechDrawGeometry::GeometryObject.findVertex(), Part::Edgecluster.GetClusters(), SandboxGui::SoWidgetShape.getQuad(), ModelRefine::FaceTypedCylinder.getType(), Fem::Constraint.getViewProviderName(), InspectionGui::ViewProviderInspection.inspectDistance(), TechDrawGeometry::Vertex.isEqual(), IslandAndOffsetLink.IslandAndOffsetLink(), Fem::Tools.isLinear(), TechDraw::DrawProjectSplit.isOnEdge(), Fem::Tools.isPlanar(), MeshCore::MeshGeomFacet.IsPointOfSphere(), TechDrawGui::QGIView.itemChange(), Part::TopoShapeFacePy.makeOffset(), Part::TopoShapeWirePy.makeOffset(), GCS::ConstraintP2PDistance.maxStep(), Span.MidParam(), CArea.NearestPoint(), CCurve.NearestPoint(), MeshCore::MeshNearestIndexToPlane< T >.operator()(), geoff_geometry::Plane.Plane(), DraftGeomUtils.pointInversion(), CCurve.PointToPerim(), Part::CylinderPy.PyInit(), Part::Circle2dPy.PyInit(), Part::ConePy.PyInit(), Part::CirclePy.PyInit(), Part::PlanePy.PyInit(), SketcherGui::ViewProviderSketch.setEditViewer(), Part::TopoShapePy.slices(), Gui::ViewProviderPlacement.ViewProviderPlacement(), and MeshCore::MeshAlgorithm.~MeshAlgorithm().

def DraftVecUtils.find (   vector,
  vlist 
)
find(vector,vlist): finds a vector in a list of vectors. returns
the index of the matching vector, or None if none is found.

References DraftVecUtils.equals().

Referenced by StdCmdOpen.activated(), StdCmdToggleVisibility.activated(), Gui::Translator.activateLanguage(), Sketcher::SketchObject.addCopy(), Gui::ViewProviderVRMLObject.addResource(), Sketcher::SketchObject.addSymmetric(), Gui::InputField.apply(), PartDesignGui.assertActivePart(), PointsGui::ViewProviderScattered.attach(), PointsGui::ViewProviderStructured.attach(), App::Document.breakDependency(), PartGui::DlgBooleanOperation.changeEvent(), DraftGeomUtils.cleanFaces(), Gui::Document.detachView(), TechDrawGui::QGIViewClip.drawClip(), Drawing::FeatureViewSpreadsheet.execute(), Fem::FemPostScalarClipFilter.execute(), Fem::FemPostWarpVectorFilter.execute(), MeshCore::MeshSurfaceSegment.FindSegment(), MeshGui::MeshFaceAddition.finishEditing(), MeshGui::MeshFillHole.finishEditing(), MeshCore::MeshPointArray.Get(), Fem::FemMesh.getccxVolumesByFace(), PartDesign::DressUp.getContiniusEdges(), MeshCore::MeshEvalTopology.GetFacetManifolds(), Gui::ExpressionBinding.getIcon(), ExpressionDelegate.getIcon(), Gui::ViewProviderVRMLObject.getLocalResources(), PartDesign::Body.getNextSolidFeature(), PartDesign::Body.getPrevFeature(), PartDesign::Body.getPrevSolidFeature(), TechDraw::DrawViewSpreadsheet.getSheetImage(), Base::Writer.getUniqueFileName(), App::Branding.getUserDefines(), Spreadsheet::PropertyRowHeights.getValue(), Spreadsheet::PropertyColumnWidths.getValue(), App::Origin.hasObject(), Gui::PropertyEditor::PropertyItem.hasProperty(), App::Application.initTypes(), PartDesign::Body.insertObject(), Part::BodyBase.isAfter(), PartDesignGui.isAnyNonPartDesignLinksTo(), FemGui::TaskFemConstraintTransform.makeText(), PartDesignGui::TaskBooleanParameters.onSelectionChanged(), PartDesignGui::TaskTransformedParameters.originalSelected(), Gui::Dialog::DlgPropertyLink.propertyLink(), Gui::Dialog::DocumentRecoveryPrivate.readXmlFile(), PartDesignGui::TaskDressUpParameters.referenceSelected(), PartDesignGui::TaskShapeBinder.referenceSelected(), PartDesignGui::TaskPipeParameters.referenceSelected(), PartDesignGui::TaskPipeOrientation.referenceSelected(), PartDesignGui::TaskPipeScaling.referenceSelected(), GCS::System.removeConstraint(), Base::SequencerP.removeInstance(), PartDesign::Body.removeObject(), Gui::PropertyEditor::PropertyEditor.removeProperty(), Gui::PropertyEditor::PropertyItem.removeProperty(), MeshCore::MeshOutput.SaveOBJ(), MeshGui::MeshSelection.setRemoveComponentOnClick(), PartGui::DlgFilletEdges.setupFillet(), GCS::System.solve(), SketcherGui.SuggestAutoMapMode(), PartDesignGui::TaskLoftParameters.TaskLoftParameters(), App::Origin.unsetupObject(), FemGui::ViewProviderFemPostObject.update(), SketcherGui::TaskDlgEditSketch.~TaskDlgEditSketch(), FemGui::TaskFemConstraintContact.~TaskFemConstraintContact(), FemGui::TaskFemConstraintDisplacement.~TaskFemConstraintDisplacement(), FemGui::TaskFemConstraintFixed.~TaskFemConstraintFixed(), FemGui::TaskFemConstraintHeatflux.~TaskFemConstraintHeatflux(), FemGui::TaskFemConstraintPlaneRotation.~TaskFemConstraintPlaneRotation(), FemGui::TaskFemConstraintPressure.~TaskFemConstraintPressure(), and FemGui::TaskFemConstraintTemperature.~TaskFemConstraintTemperature().

def DraftVecUtils.getPlaneRotation (   u,
  v,
  w = None 
)
def DraftVecUtils.getRotation (   vector,
  reference = Vector(1,0,0) 
)
getRotation(vector,[reference]): returns a tuple
representing a quaternion rotation between the reference
(or X axis if omitted) and the vector

References DraftVecUtils.isNull().

def DraftVecUtils.isColinear (   vlist)
isColinear(list_of_vectors): checks if vectors in given list are colinear

References DraftVecUtils.angle(), and DraftVecUtils.precision().

Referenced by importDXF.drawPolyline().

def DraftVecUtils.removeDoubles (   vlist)

References DraftVecUtils.equals().

Referenced by ArchRoof.makeRoof().

def DraftVecUtils.rotate2D (   u,
  angle 
)
def DraftVecUtils.scale (   u,
  scalar 
)
def DraftVecUtils.toString (   u)

Referenced by DraftTools.Offset.action(), App::ObjectIdentifier.addComponents(), DraftTools.Rectangle.createObject(), DraftTools.Ellipse.createObject(), DraftTools.Text.createObject(), DraftTools.Dimension.createObject(), DraftTools.ShapeString.createObject(), DraftTools.Dimension.createOnMeasures(), Gui::PropertyEditor::PropertyItem.data(), DraftTools.Arc.drawArc(), DraftTools.Polygon.drawPolygon(), Gui::QuantitySpinBox.event(), TechDrawGui::TaskSectionView.formatVector(), TechDrawGui::TaskProjGroup.formatVector(), ArchPanel.CommandPanel.getPoint(), PartGui::DlgExtrusion.getShapesToExtrude(), PartGui::DlgRevolution.getShapesToRevolve(), DraftTools.DraftTool.getStrings(), App::ObjectIdentifier::Component.isArray(), App::ObjectIdentifier::String.isForceIdentifier(), App::Expression.isTouched(), App::CellAddress.isValid(), ArchStructure.makeStructuralSystem(), DraftTools.Mirror.mirror(), DraftTools.Move.move(), DraftTools.Offset.numericRadius(), Gui::UIntSpinBox.onChange(), Gui::QuantitySpinBox.onChange(), Gui::PropertyEditor::PropertyItem.propertyBound(), Gui::UIntSpinBox.resizeEvent(), Gui::QuantitySpinBox.resizeEvent(), Gui::IntSpinBox.resizeEvent(), Gui::DoubleSpinBox.resizeEvent(), DraftTools.Rotate.rot(), Base::Matrix4D.scale(), DraftTools.Scale.scale(), Gui::Dialog::ButtonView.selectButton(), Gui::IntSpinBox.setExpression(), Gui::DoubleSpinBox.setExpression(), Gui::Dialog::DlgSettingsColorGradientImp.setRange(), Gui::ViewProvider.setStatus(), SketcherGui::PropertyConstraintListItem.setValue(), Gui::PropertyEditor::PropertyVectorItem.setValue(), Gui::PropertyEditor::PropertyVectorDistanceItem.setValue(), Gui::PropertyEditor::PropertyMatrixItem.setValue(), SketcherGui::SketcherValidation.SketcherValidation(), Gui::PropertyEditor::PropertyPlacementItem.toolTip(), Gui::PropertyEditor::PropertyIntegerItem.toString(), Gui::PropertyEditor::PropertyIntegerConstraintItem.toString(), Gui::PropertyEditor::PropertyAngleItem.toString(), Gui::PropertyEditor::PropertyVectorItem.toString(), Gui::PropertyEditor::PropertyMatrixItem.toString(), Gui::PropertyEditor::PropertyPlacementItem.toString(), Gui::SoFCOffscreenRenderer.writeToImageFile(), zipios::ZipCDirEntry.ZipCDirEntry(), zipios::ZipLocalEntry.ZipLocalEntry(), Gui::PropertyEditor::PlacementEditor.~PlacementEditor(), and App::RangeExpression.~RangeExpression().

def DraftVecUtils.typecheck (   args_and_types,
  name = "?" 
)

Variable Documentation

DraftVecUtils.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")