Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This macro positioned your object perpendicularly to wire selected.
# -*- coding: utf-8 -*-
__title__ = "Macro Perpendicular To Wire"
__author__ = "Mario52"
__url__ = ""
__version__ = "00.02"
__date__ = "06/04/2019"
import Draft, Part
sel = FreeCADGui.Selection.getSelection() # Select an object
lineSelected = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0] # first object the Path object or SubObjects
myCircle = sel[1] # second object
pointsDirection = []
pointsDirection = lineSelected.discretize(Number=500) # discretize the path line first selection
v=pointsDirection[0].sub(pointsDirection[1]) # avec vecteurs 1 et 2 (direction debut ligne)
pl=FreeCAD.Placement() # placement object
pl.Rotation.Q = r.Q
pl.Base = pointsDirection[0]
myCircle.Placement = pl
del pointsDirection[:]
except Exception:
print( "Select twoo objects 1:The path 2:The objet to align" )

This comment has been minimized.

Copy link
Owner Author

@mario52a mario52a commented Jan 30, 2017

This macro utility is intended for the use of the program FreeCAD
The icon for your toolbar, it is to place in your macros directory (in the same location of the macro)

macro_perpendicular_to_wire Rename in Macro_Perpendicular_To_Wire.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment