Design Idea: Sketcher 'Point' and TechDraw

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
rich61
Posts: 156
Joined: Sat Jul 20, 2019 9:56 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by rich61 »

Thanks Carlo

I uploaded a PDF file

https://forum.freecadweb.org/viewtopic.php?f=8&t=74850

On coding, the last coding I did was on micro controllers and DSP chips for real time hardware, such as motor control and other power circuits.

Most of that was done in assembly language and old fashioned 'C' lanugage.

Sound like the 'Dark Ages' ?

rich
domad
Veteran
Posts: 2096
Joined: Mon Jun 22, 2020 12:16 pm

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by domad »

chrisb wrote: Thu Dec 29, 2022 1:41 pm ...
Opening your file I still cannot see any point. Is there a setting, e.g. for the color of such points?
Greetings to the Community!
I'm sorry if I didn't answer right away, I haven't been to the computer.
I don't think I have particular settings, I suggest you try to "play" in TechDraw preferences with the "Vertex Scale" setting and with the "Line width" parameter of the view.
chrisb
Veteran
Posts: 54273
Joined: Tue Mar 17, 2015 9:14 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by chrisb »

wandererfan wrote: Thu Dec 29, 2022 1:15 pm Does setting "Show loose 2d geometry" help?
Sorry, I had missed your post. Yes this did the job. It just needs the setting and a recompute.
Thanks!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
onekk
Veteran
Posts: 6222
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by onekk »

rich61 wrote: Thu Dec 29, 2022 6:28 pm ...
I learned to program with Commodore 64.

PDF file is not old fashioned if make correctly, but in a forum is better to discuss directly.

As said in other posts, I think that the way FreeCAD development is done has some flaws, but as the project is complex, there are too many people that "want to reinvent the wheel" so many efforts are wasted.

IMHO better to "offer help in improving things", so instead of making blindly PR or trying to make all by yourself, it is a more clever move to make a post that sounds like:

"I'm in interested in improving FreeCAD in this area..."

"did some developers have some hints about how to do such things" or

"There are already efforts done where I could help?"

Something similar to this tone, as probably there are maybe some Feature Request open or maybe already some PR pending and "needing for cares".

@Kunda1 are you aware of something about?

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
chrisb
Veteran
Posts: 54273
Joined: Tue Mar 17, 2015 9:14 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by chrisb »

I don't know how often points from sketches are needed in TechDraw, so here is a first easy to handle workaround: I have written a macro, which creates a Part point and attaches it to a sketch point.
As my Python knowledge is extremely limited, I would be glad for hints for improvement. A nice name for it would be welcome too, I'm not very happy with my current "pointFromSketch.py" and so I post it here in the text.

Code: Select all

import Part,PartGui

obj = Gui.Selection.getSelectionEx()[0].Object
objName = Gui.Selection.getSelectionEx()[0].ObjectName
sketchVertex = Gui.Selection.getSelectionEx()[0].SubElementNames[0]

newVertex = App.ActiveDocument.addObject("Part::Vertex","Vertex")
newVertex.X=0.0
newVertex.X=0.0
newVertex.Y=0.0
newVertex.Z=0.0
newVertex.Placement=App.Placement(App.Vector(0.0,0.0,0.0),App.Rotation(App.Vector(0.0,0.0,1.0),0.0))
newVertex.Label='Vertex'


newVertex.AttachmentOffset = App.Placement(App.Vector(0.0, 0.0, 0.0),  App.Rotation(0.0, 0.0, 0.0))
newVertex.MapReversed = False
newVertex.Support = [(obj,vertex)]
newVertex.MapPathParameter = 0.0
newVertex.MapMode = 'Translate'
newVertex.recompute()
Usage:
- select a (single!) point from a sketch
- rund the macro

The next step would be to allow to select multiple points and to make it fool proof.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
rich61
Posts: 156
Joined: Sat Jul 20, 2019 9:56 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by rich61 »

Carlo,

I remember the Commodore 64, but I didn't have one. I have a friend in the UK who had a BBC computer, might have been a Sinclair. I had an Altair, probably got it in 76 or 77. And I appreciate your advice and tips. And, I'm not trying to change FreeCAD, I'm only illustrating some of my observations. Its not easy in a forum, normally my thoughts are all muddled up, and over time I can clarify them a little bit. I use Writer to clarify my thoughts, to organize, and present them in the right sequence. That is very difficult in a forum.

Here, let me present some more observations.

I was thinking about the method of getting the point from a sketch. I looked at the FreeCAD file, not hard to scan and parse for that stuff. I modified my example like this, there is a pocket on bottom, on xy plane, and it was padded normal. Just a technical point, the standard FreeCAD point would be on the XY plane, Z=0. So, it would be on the bottom? Would a Top View show the point ? In these images, I'm using what I had called a 3D point, so you can see where it is an all orientations.

If it was padded reverse, or symmetrically, Z would still be 0. In TechDraw, do you see the Sketcher Point no matter what ?

But a bit more interesting, look at the Bottom View in the TechDraw image below. The View has flipped on the X axis. So, if a Sketcher point was on the Bottom View, where would it be. The position changes in the view. I guess there would have to be some program logic developed for that. Of course if the 'Point' is a 3D point, there are no decisions to make, no code to write, the point just is where it is. Its an affliction that I have, WAB ( work avoidance behavior).

FreePoint1.png
FreePoint1.png (7.55 KiB) Viewed 897 times
FreePoint2.png
FreePoint2.png (6.7 KiB) Viewed 897 times
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by wandererfan »

chrisb wrote: Fri Dec 30, 2022 1:25 pm A nice name for it would be welcome too, I'm not very happy with my current "pointFromSketch.py" and so I post it here in the text.
We seem to have settled on "datum" elsewhere, so the general command could be "addDatumGeometry". Not sure where datums would come from other than sketches and axes, but I guess random points/edges should be allowed too.

chrisb wrote: Fri Dec 30, 2022 1:25 pm The next step would be to allow to select multiple points and to make it fool proof.
“A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.”
- Douglas Adams, Mostly Harmless

"Nothing is fool-proof to a sufficiently talented fool."
- Stephen Hawking
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by wandererfan »

rich61 wrote: Fri Dec 30, 2022 1:52 pm But a bit more interesting, look at the Bottom View in the TechDraw image below. The View has flipped on the X axis. So, if a Sketcher point was on the Bottom View, where would it be. The position changes in the view. I guess there would have to be some program logic developed for that.
The Sketcher point would be projected according to the View's Direction and XDirection properties. If the XDirection is flipped, then the point will move accordingly.
rich61
Posts: 156
Joined: Sat Jul 20, 2019 9:56 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by rich61 »

I don't think anyone 'needs' points in sketcher. All I do is something to create a vertex and I've been doing that for a long time. Then it appears in TechDraw so I can use it for dimensions or other purposes. I can't remember exactly when Cosmetic Features were introduced, they are helpful, but frustrating sometimes. To delete one, I have to remind myself to use the cosmic eraser, not the delete key.

An old co-worker once explained 'The Principle of Least Astonishment'. https://en.wikipedia.org/wiki/Principle ... tonishment

I didn't detect much interest, so there are better things for developers to work on. Let 3D points, or points in TechDraw be an academic exercise. As others have pointed out, there are already ways to do this things that most people don't have to do anyway.

I need to find something on open cascade and learn more about it. In 3D space, it seems just to me, like a Point object is conspicuously missing. Functions like sketcher and part design are inputs to the 3D model, and functions like TechDraw are viewers of the 3D model. So, it would be nice if that was the single place to put and get all data that one wants. But, the world isn't always perfectly synergistic and symmetrical.

I like your python program. Something I can learn.


chrisb wrote: Fri Dec 30, 2022 1:25 pm I don't know how often points from sketches are needed in TechDraw, so here is a first easy to handle workaround: I have written a macro, which creates a Part point and attaches it to a sketch point.
As my Python knowledge is extremely limited, I would be glad for hints for improvement. A nice name for it would be welcome too, I'm not very happy with my current "pointFromSketch.py" and so I post it here in the text.

Code: Select all

import Part,PartGui

obj = Gui.Selection.getSelectionEx()[0].Object
objName = Gui.Selection.getSelectionEx()[0].ObjectName
sketchVertex = Gui.Selection.getSelectionEx()[0].SubElementNames[0]

newVertex = App.ActiveDocument.addObject("Part::Vertex","Vertex")
newVertex.X=0.0
newVertex.X=0.0
newVertex.Y=0.0
newVertex.Z=0.0
newVertex.Placement=App.Placement(App.Vector(0.0,0.0,0.0),App.Rotation(App.Vector(0.0,0.0,1.0),0.0))
newVertex.Label='Vertex'


newVertex.AttachmentOffset = App.Placement(App.Vector(0.0, 0.0, 0.0),  App.Rotation(0.0, 0.0, 0.0))
newVertex.MapReversed = False
newVertex.Support = [(obj,vertex)]
newVertex.MapPathParameter = 0.0
newVertex.MapMode = 'Translate'
newVertex.recompute()
Usage:
- select a (single!) point from a sketch
- rund the macro

The next step would be to allow to select multiple points and to make it fool proof.
rich61
Posts: 156
Joined: Sat Jul 20, 2019 9:56 am

Re: Design Idea: Sketcher 'Point' and TechDraw

Post by rich61 »

The Sketcher point would be projected according to the View's Direction and XDirection properties. If the XDirection is flipped, then the point will move accordingly.
I apologize. Obviously I don't know the system. I hadn't realized that the point gets projected, but that's great.
Post Reply