Import dimensions from sketch to Techdraw views

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Import dimensions from sketch to Techdraw views

Post by abdullah »

-alex- wrote: Sat Nov 20, 2021 11:54 am Sketches are very upstream objects, hence very reliable, that's why IMO it would be very reliable to import dimensions from those upstream objects to TD views very downstream objects. It would be a very strong way to shortcut any topological issues.
I do not want to extend, but I think you should know the following piece of information:

There is a substantial difference between (1) seeking stability by using edges of Sketches instead of edges of 3D shapes, and (2) importing dimensional constraints from the sketcher.

For (1) you treat the sketch as a wire. You are exposed to edge reordering in FreeCAD master. You are much less exposed in RT's branch because how he creates the wires (toponaming improvement). Whatever the branch, the likelihood of breaking is lower. But this alone is not going to give you a "constraint import". It is going to give you a more stable edge on which you may add a dimension in TechDraw (or not) as per your choice. It may still break.

For (2) you need to treat the geometry of the sketch and the constraints of the sketch (what is used in sketch in edit mode). Those are not wires or OCCT shapes. They are actual Part objects and actual constraints operating on the geometry objects. You will need to handle hidden lines yourself. This would be hyper robust (unless you delete the constraints in the sketch), but involves lots of effort in drawing.
User avatar
Shalmeneser
Veteran
Posts: 9475
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: Import dimensions from sketch to Techdraw views

Post by Shalmeneser »

Do we need to create a third type of dimension ?
* normal (to constrain the sketch)
* reference (to see or name a dimension)
* blueprint (will be automatically ? seen in TechDraw)
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

chrisb wrote: Sat Nov 20, 2021 5:51 pm Let me give an example. It uses equality constraints, I am sure thant tangency, horizontal, or parallel can lead to similar situations. I am not an expert in blueprints at all, I can only state that I have acquired some expertise in sketching, so forgive me if there are better ways to dimension the drawing:
Image
On a technical drawing this may look like this:
Image
Someone who knows already during sketching that he will have later to go through the whole dimensioning process of the drawing may be intrigued to do that only once and he may just repeat the dimensions in the sketch. After all this may be faster, and, as you say, more stable and it may even save his job. But I would not call the sketch being perfect.
Hum, I guess I understand your meaning, but I'm not sure BTW. I hope my reply will be not offtopic:
Concerning the workflow I'm talking about, and about your example, you can use equality constraints and so on in the sketch, that's fine you're right. But you need to add some dimensions as well which are marked "as reference". Dimensions marked "as reference" would coresspond to black dimensions in your drawing. You see what I mean?
All this stuff would deserve a tutorial, but their is no tools in FC yet to do that. I can't make a tutorial before the tools...
I am all for FreeCAD to progress!
We are agree :)
(But not every step is a step forward)
Sure, that's why it is important to discuss and explain. That's what I'm trying to do here.
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

abdullah wrote: Sat Nov 20, 2021 5:57 pm I do not want to extend, but I think you should know the following piece of information:
There is a substantial difference between (1) seeking stability by using edges of Sketches instead of edges of 3D shapes, and (2) importing dimensional constraints from the sketcher.
yes (2) that's the point: importing dimensional constraints "objects" from the sketcher inside editing mode, and only those objects if it's possible.

For (1) you treat the sketch as a wire. You are exposed to edge reordering in FreeCAD master. You are much less exposed in RT's branch because how he creates the wires (toponaming improvement). Whatever the branch, the likelihood of breaking is lower. But this alone is not going to give you a "constraint import". It is going to give you a more stable edge on which you may add a dimension in TechDraw (or not) as per your choice. It may still break.
I fully agree, and that's not my aim here to use sketches geometries in Techdraw.


Disclaimer: here below I read your words but I have no idea about the underlayed stuffs here, so it's difficult for me to fully get your meaning, but I try :?
For (2) you need to treat the geometry of the sketch and the constraints of the sketch (what is used in sketch in edit mode)
"What is used in sketch in edit mode"? You mean about constraints of the sketch only or both geometrie and constraints?
Those are not wires or OCCT shapes. They are actual Part objects and actual constraints operating on the geometry objects.
Ok, interesting, so elements are kind of an intermediate state in sketcher editing right? Managed by plane GCS right? Then when closing the editing mode OCCT elements are generated right?
You will need to handle hidden lines yourself
Why should I deal with hidden lines? I would collect only dimensional constraint objects from sketcher editing mode. Hidden line concerns rather geometries IMO, you lost me :?
This would be hyper robust (unless you delete the constraints in the sketch),
Yes it would I think so, unless you delete the constraints in the sketch of course yes :)
but involves lots of effort in drawing
You mean about coding (I trust you) or workflow (I'm not worry for that)?
Last edited by -alex- on Sat Nov 20, 2021 8:15 pm, edited 1 time in total.
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

Shalmeneser wrote: Sat Nov 20, 2021 6:14 pm Do we need to create a third type of dimension ?
* normal (to constrain the sketch)
* reference (to see or name a dimension)
* blueprint (will be automatically ? seen in TechDraw)
IMO we shouldn't create any new objects (from user point of view). Driving and driven (as reference) dimensional constraint are enough. The point is about how to import those objects (or linked copy of those objects) in TD views then how to be able to adjust their position in projected views.
Last edited by -alex- on Sat Nov 20, 2021 10:20 pm, edited 2 times in total.
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: Import dimensions from sketch to Techdraw views

Post by chrisb »

Shalmeneser wrote: Sat Nov 20, 2021 6:14 pm Do we need to create a third type of dimension ?
* normal (to constrain the sketch)
* reference (to see or name a dimension)
* blueprint (will be automatically ? seen in TechDraw)
The last should also be divided in two: driving and driven. I am afraid it will not help very much with the basic question discussed here.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Import dimensions from sketch to Techdraw views

Post by abdullah »

-alex- wrote: Sat Nov 20, 2021 6:51 pm Ok, interesting, so elements are kind of an intermediate state in sketcher editing right? Managed by plane GCS right? Then when closing the editing mode OCCT elements are generated right?
Geometry elements are not an intermediate state. They are the actual source of information defining the sketch of geometry. This elements are the ones that can be constrained. This "higher level" information is then used to generate the simplified representation that is the wire(s) and vertex (the Shape object). The rest of FreeCAD uses this simplified representation.

There are few exceptions. The Draft converter to Sketch does know about this "higher level" information.

GCS does not manage these. The Sketcher WB manages it (SketchObject contains them). GCS is yet another abstraction of geometry and constraints that are suited to perform the actual solving. There is an interface called "Sketch" between Sketcher WB and GCS.

Yes, when closing the editing mode the wires are generated from Geometries solved according to the Constraints.
-alex- wrote: Sat Nov 20, 2021 6:51 pm Why should I deal with hidden lines? I would collect only dimensional constraint objects from sketcher editing mode. Hidden line concerns rather geometries IMO, you lost me
If you wanted to draw the geometry of the sketcher, you would need to handle hidden lines. If you only want to draw sketcher constraints, you should not need to.
domad
Veteran
Posts: 2053
Joined: Mon Jun 22, 2020 12:16 pm

Re: Import dimensions from sketch to Techdraw views

Post by domad »

Greetings to the Community!
There is no doubt that the possibility of transferring the dimensions of a sketcher to TechDraw would give a significant increase in quality and stability to the pages of TechDraw, resizing (not eliminating) the problem of topoological renaming/redefinition .
But, as already mentioned in previous replies, the setting of the constraints does not always coincide with that of the dimensions of a technical drawing (different purposes and needs).
To overcome this problem, a "dimension" function (bindingly irrelevant) could be added to the Workbench Sketcher exclusively to represent useful dimensions for the purposes of a technical drawing, adding to the sketcher dimension popup, a checkbox with the words "technical drawing quota" (in the same way as the "reference" checkbox).
In the same way, in Draft the “Dimension” tool could be enhanced making it fully representable in TechDraw (not as happens with the “insert Draft object” function).
If you allow my humble opinion, the most advanced and stable system is that of Medusa4, which provides as a final result, unlike the other cads, the 3D model (not vice versa).
In a nutshell, in Medusa4, we start from the 2D technical drawing (views, dimensions, details, etc.) to generate the 3D model (of a body and / or a part and / or an assembly).
Could it be a workflow that can be implemented in FreeCad?
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

abdullah wrote: Mon Nov 22, 2021 1:13 pm Geometry elements are not an intermediate state. They are .... solved according to the Constraints.
Thank you for your kind explanations, much appreciated. I have a lack of underlayed knowledge required , but I guess I've got your meaning.
If you only want to draw sketcher constraints, you should not need to.
Yes that's only what I want, only draw sketcher constraints, or Techdraw constraints linked to sketcher's one. I will explain below or later (it's late here).
domad wrote: Mon Nov 22, 2021 2:04 pm resizing (not eliminating) the problem of topoological renaming/redefinition
First, thanks for your interest to dimensioning drawing stuffs.
What you said above is both right and wrong IMO. Generaly speaking it could be right, but concerning what I would like to plan it's wrong.
My aim is to link directly dimension constraints in TD's view from Sketches in 3D model. Hence the robustness will be similar to the dimensions of sketches = very reliable. As @Abdullah said:
This would be hyper robust (unless you delete the constraints in the sketch)
That's my opinion as well and that's why I've opened this topic.
.....In the same way, in Draft the “Dimension” tool could be enhanced making it fully representable in TechDraw (not as happens with the “insert Draft object” function)..... Medusa4....Could it be a workflow that can be implemented in FreeCad?
I see your meaning and I respect your intention, but it would deserve another topic maybe. Here I'm going to focus to my original aim, it is already a hard task for me to talk and try to code a little bit (I'm a noob in coding) about it. No offense. Please jump into this party, then if we get some good results we could try to extend the plan to Draft dimension objects if that make sens. I'm not sure, because AFAIK you would do the job twice here (positioning of Draft geometries + 3D dimensioning). BTW and AFAIK the workflow you linked in your previous post is already powerful at this point.


First I should repeat that my aim would be to import dimensions from sketches to TD view. I have strong reasons for that:
- sketcher WB is a very powerful way to start 3D modeling of mecanical parts
- it's very upstream and reliable topologicaly
- the 2D solver ease a lot the job of geometries placement
- you get the sketch geometry by using constraints, namely dimension constraints hence you do both placement ans dimensioning job at the same time. Hence you do the job once, not twice.
- you save time and health (mouse clicks -> carpal tunnel syndrome)

Actually my plan is cristal clear in my mind but it would depend what Abdullah would reply. Because it's pretty easy to have a plan, but much more difficult to write the code then get it works :roll: (this is not a request, any help would be appreciated though).

If that make sens, here is the plan:
Because i don't know so much the official FC vocabulary or the code vocabulary I introduce below my own vocabulary:
Here after I will name dimension constraint as "dimension", then:
Vocabulary-elements.png
Vocabulary-elements.png (35.07 KiB) Viewed 2312 times

1- dimension text position
2- dimension line
3- extension line
4- extension line end
5- point
6- Sketch LCS

As @wandererfan said:
Picking a length/angle constraint and saying make a dimension in this view is likely quite possible. Assuming the projection direction aligns with the sketch normal, among other things. It would be a kind of free floating dimension, not actually linked to an edge in the drawing.

In fact I wouldn't even pick up dimensions from sketcher, we could rather create a dimensions in a TD view by using python method TechDraw.makeDistanceDim3d that takes 2 3D points (see previous posts of @wandererfan). Then those points would be linked to the coordinates of related points in sketcher, for each dimension of the sketch.
Of course the TD dimension value would be linked to the related one of sketch.

So, for eg. about a linear dimension, the user would select both a sketch and the related TD view, then:

1- inside the sketch: collect local sketch coordinates of both points, then link it to the dimension's name (is it possible Abdullah? python access?)
3- transform local sketch coordinates of points to global coordinates then to TD view coordinates
4- create two points in the view selected by user. Those point would be linked to the points in sketch in order to updates on model changes.
5- create TechDraw.makeDistanceDim3d that takes the 2 points
6- ideally it would be great to be able to move extension line ends of the TD dimension (shorten or lenghten the extension lines I mean), in order to get a better drawing. Not possible yet AFAIK in TD.

The user would dimension the drawing by selecting sketch by sketch to import items step by step in each selected appropriate (normal to the selected sketch) TD view.
With this workflow the user would the dimensioning job only once (mainly inside sketches) and TD dimensions would update automaticaly while 3D model changes.
At this level it would save again a lot of time and mouse clicks -> carpal tunnel syndrome :-)
edi wrote:ping
Edi, what's your opinion about all of this?
Any comments and help are welcome.
domad
Veteran
Posts: 2053
Joined: Mon Jun 22, 2020 12:16 pm

Re: Import dimensions from sketch to Techdraw views

Post by domad »

.... :?:
Attachments
Quote_Sketcher.png
Quote_Sketcher.png (194.54 KiB) Viewed 2214 times
Post Reply