When the mouse hovers over features in the tree view or over edges in the Sketcher Element tile, the objects under the cursor highlight in the 3D view.
Would it be possible to do that from Python and display a plane in 3D view when the cursor is over a sketch?
The plane would be translucent and represent the placement of the sketch. While the Python code was running it would allow a quick look at where the sketch is. Much like Datum shows when not hidden. But, I'm thinking something more dynamic and transient.
I know the have been several forum threads about some visual indication of where a sketch is, but most of those have been talking about a visual LCS.
Is this even possible from Python? Or am I letting an idle mind wander.
Sketch visual location tool
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Sketch visual location tool
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
-
- Veteran
- Posts: 3194
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Sketch visual location tool
Code: Select all
doc = App.ActiveDocument
obj = doc.getObject("Sketch001")
gpl = obj.getGlobalPlacement()
plane = Part.Plane()
plane.Position = gpl.Base
plane.Axis = gpl.Rotation.multVec(App.Vector(0,0,1))
Part.show(plane.toShape())
- Attachments
-
- sketchplane.FCStd
- (8.67 KiB) Downloaded 7 times
-
- Screen Shot 2022-06-08 at 12.39.13 PM.png (12.72 KiB) Viewed 570 times
-
- Veteran
- Posts: 3194
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Sketch visual location tool
Good to show the origin and axes, too.
Inside a body need to make Datum Lines and Planes instead.
Code: Select all
doc = App.ActiveDocument
obj = doc.getObject("Sketch001")
gpl = obj.getGlobalPlacement()
plane = Part.Plane()
plane.Position = gpl.Base
plane.Axis = gpl.Rotation.multVec(App.Vector(0,0,1))
Part.show(plane.toShape(), obj.Name + '_Plane')
line_x = Part.Line()
line_y = Part.Line()
line_x.Location = gpl.Base
line_y.Location = gpl.Base
line_x.Direction = gpl.Rotation.multVec(App.Vector(1,0,0))
line_y.Direction = gpl.Rotation.multVec(App.Vector(0,1,0))
Part.show(line_x.toShape(), obj.Name + '_X')
Part.show(line_y.toShape(), obj.Name + '_Y')
Re: Sketch visual location tool
I made this macro long time ago, it should work. When you click on a tree sketch it hides everything and highlights the sketch elements for 1 second.
I suppose the origins could be turned on also. Maybe this will help.
I have never tried to get selections by hovering in the tree. I thought that only worked in the 3D.
I suppose the origins could be turned on also. Maybe this will help.
I have never tried to get selections by hovering in the tree. I thought that only worked in the 3D.
- Attachments
-
- Sketcher_flasher.FCMacro
- (5.79 KiB) Downloaded 11 times
Re: Sketch visual location tool
I'll take a look at these later (on a tablet ATM).
But, I was thinking of when the script was running it would be more like a role over in the tree would pop up the sketch. Move the mouse to another sketch in the tree and that location would replace the last.
Maybe these do that, I'll have a look in a bit.
But, I was thinking of when the script was running it would be more like a role over in the tree would pop up the sketch. Move the mouse to another sketch in the tree and that location would replace the last.
Maybe these do that, I'll have a look in a bit.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."