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!
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

domad wrote: Tue Nov 23, 2021 1:22 pm.... :?:
What do you mean?
domad
Veteran
Posts: 2094
Joined: Mon Jun 22, 2020 12:16 pm

Re: Import dimensions from sketch to Techdraw views

Post by domad »

Could it be a (valid?) Codable / achievable idea? Not visible in the 3D view but visible in TechDraw (also in axonometry). This could be fine with unique objects or monolithic bodies but would become a problem for parts or assemblies of bodies, in which case it would be necessary to implement "Dimension" of Draft and / or the creation of specific sketchs for the representation of the positioning.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

domad wrote: Tue Nov 23, 2021 2:19 pm Could it be a (valid?) Codable / achievable idea?

In my plan such tolerance values could be added downstream in imported TD dimension as well.
However I agree it would be better to add tolerance information in sketches because it's upstream.
I have no idea if it's a peace of cake to code or a tough nut to crack. Abdullah will reply to this I hope.

Not visible in the 3D view but visible in TechDraw (also in axonometry).
IMO such tolerances should be visible in sketches, if so. The user have to see easily the information at the level it is. Otherwise I would prefer tolerances in TD dimensions only.

This could be fine with unique objects or monolithic bodies but would become a problem for parts or assemblies of bodies, in which case it would be necessary to implement "Dimension" of Draft and / or the creation of specific sketches for the representation of the positioning.
Your point is crystal clear. Here my aim with the imported dimensions concerns mainly single parts indeed.
For assemblies (multiple bodies assemblies or Asm2/3/4 multiple parts assemblies) the user could achieve the drawing dimensioning using the 3D Draft dimensions you've mentioned above, or just using standard TD dimensions. IMO the use of not less robust dimensions for assemblies is not a major issue, far less important than dimensioning of single parts to my eyes. Because single part drawings matter so much compare to assembly drawings, due to the fact single parts are relevant with machining so that's a big deal. Assembly drawings are not so important and include far less dimensions. But remember, here I'm talking about mechanical parts/assemblies. About Arch and building drawings it's different (not removable parts), Draft workflow is more suitable to this.
If single mechanical parts definition is correct, 95% of the job is done, then assembly will not fail at workshop.
Last edited by -alex- on Wed Nov 24, 2021 5:55 pm, edited 1 time in total.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

First issue, my plan does not work.
Method (TechDraw.makeDistanceDim3d) creates a dimension on vertexes, so it's not topological agnostic :|
As first test, in the test file below I've created a TechDraw.makeDistanceDim3d:

Code: Select all

dvp = App.ActiveDocument.View
typeL = 'Distance'
typeX = 'DistanceX'
typeY = 'DistanceY'

v13d = FreeCAD.Vector(2, 2, 20)
v23d = FreeCAD.Vector(8, 12, 20)
TechDraw.makeDistanceDim3d(dvp, typeL, v13d, v23d)

v12d = FreeCAD.Vector(0, 0, 0)
v22d = FreeCAD.Vector(10, 10, 0)
TechDraw.makeDistanceDim(dvp, typeX, v12d, v22d)
But, if you add "Cube001 to the source property of view object, it's a mess.
So, maybe it is necessary to find or create a TD dimension object which needs coordinates values (topo agnostic) as input instead of vertexes.
Does such dimension object already exist?
test_TD_makeDistanceDim3d.FCStd
(19.73 KiB) Downloaded 26 times
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

From this thread: https://forum.freecadweb.org/viewtopic. ... 54#p560854
wandererfan wrote: Tue Jan 11, 2022 3:00 pm This is a bit like the intent of Landmark Dimension - base the measurement on known, fixed points.
I didn't know about this feature sorry! :) :oops:
Yes it is a bit similar, but if I understand Landmark Dimension correctly you have to do the job twice with it: dimensioning in sketcher once, then in TD twice.
IMO a better strategy would be to match the base points of a TD dimension with the base points of his "twin" dimension in a sketch.
In fact it would be better to use coordinates information to place base points of constraint's extension lines without creating no any points document object in tree view. All would be under the hood.
You see what I mean?
1- in a sketch: collect base points coordinates of dimension constraints (global LCS)
2- collect each coordinate of each base points in the sketch then match it with any related dimension of the sketch
3- insert "twin" dimensions a selected TD view (with same orientation than the selected sketch) with base of extension lines placed at the same coordinates that the ones in the selected sketch (global LCS). The shape and position of imported dimensions would be similar with the ones of sketch, by default. Then it would be possible to move bases of extension lines (along extension lines direction only!) to improve the readability of drawing. It would be possible to move the text position and the dimension line as well.
4- of course the value of "twin" dimension will be equal with the original one in the sketch, but any name or additional comment would be dynamically linked to avoid non-homologous information between sketches and drawing.
What's your opinion about such plane?
Is it possible to create a new TD dimension feature (or to modify Landmark Dimension) with coordinates arguments as input for bases of extension lines?
Thanks for your attention.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Import dimensions from sketch to Techdraw views

Post by wandererfan »

-alex- wrote: Tue Jan 11, 2022 11:03 pm Is it possible to create a new TD dimension feature (or to modify Landmark Dimension) with coordinates arguments as input for bases of extension lines?
Yes, it is possible. This is effectively what happens behind the scene - the coordinates of the vertex reference are extracted and projected into 2d, then the dimension is drawn.

I had done some work on extracting geometry and constraints from sketches, but sadly that work was lost. As I recall, going from Sketcher's Geometry2d to OCC to Qt QPainterPath was fairly straight forward, but Constraints are complicated to interpret. Will have to recreate this work sometime.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Import dimensions from sketch to Techdraw views

Post by -alex- »

wandererfan wrote: Wed Jan 12, 2022 2:27 pm Yes, it is possible. This is effectively what happens behind the scene - the coordinates of the vertex reference are extracted and projected into 2d, then the dimension is drawn.
Great!
So it is possible to collect vertex coordinates of sketches then use it as input for bases of extension lines of TD dimensions, that's great.
I had done some work on extracting geometry and constraints from sketches, but sadly that work was lost. As I recall, going from Sketcher's Geometry2d to OCC to Qt QPainterPath was fairly straight forward
maybe I get you wrong, but when you say "going from Sketcher's Geometry2d to OCC" I guess there is OCC elements in you workflow, there is?
I hope there isn't, in order to be topo agnostic.
but Constraints are complicated to interpret.
@Abdullah could maybe help here?
You mean it's complicated to associate vertexes in sketches to the related dimensions?
Will have to recreate this work sometime
That would be great, what a pity you've lost your previous work. Hope you'll make some progress. I can't help so much due to my lack of skills in programming, sorry.
Post Reply