Rotating a part around an axis in Script

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
korcun
Posts: 1
Joined: Wed Nov 30, 2022 12:56 pm

Rotating a part around an axis in Script

Post by korcun »

Hi guys, I've created a cylinder(vessel) and now trying to place other small cylinders around it. The small cylinders are simply drawn connections. How can I rotate the connections around the vessel? I want to place more than one connection around the vessel but at different height and different angle, and of course the radius (the distance from the center of the vessel to the outside surface) should be the same for each of them (100)

import Mesh
import math
import Draft
import ImportGui; import Part; from FreeCAD import Base
doc = FreeCAD.newDocument()

#The vessel:
cyl = doc.addObject("Part::Cylinder","Vessel")
cyl.Placement.Base = (0,0,0)
cyl.Radius = 100;
cyl.Height = 200;

#dimension of the connections:
cyl_con = Part.makeCylinder(25,40,Base.Vector(0,0,0))
User avatar
Shalmeneser
Veteran
Posts: 9474
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Rotating a part around an axis in Script

Post by Shalmeneser »

Put your code between '[ c o d e' tags :
(provide your version info)

Code: Select all

import Mesh
import math
import Draft
import ImportGui; import Part; from FreeCAD import Base
doc = FreeCAD.newDocument()

#The vessel:
cyl = doc.addObject("Part::Cylinder","Vessel")
cyl.Placement.Base = (0,0,0)
cyl.Radius = 100;
cyl.Height = 200;

#dimension of the connections:
cyl_con = Part.makeCylinder(25,40,Base.Vector(0,0,0))
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Rotating a part around an axis in Script

Post by edwilliams16 »

Consult https://wiki.freecadweb.org/Sandbox:Edw ... _rotations - if I understand what you are trying to do.
Post Reply