Woodworking - getDimensions

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Woodworking - getDimensions

Post by onekk »

dprojects wrote: Sat Jan 22, 2022 7:32 pm The labeling simplifies the process with no doubt but FreeCAD allow only add color to the face. No description, no custom text. So, you can't do nothing more during design process.

You could ever put some text over images as separate objects, as you model it with scripting, is a matter of inding the bounding box and defining some offset to recenter the text:

Code: Select all

    obj = Draft.make_text(text, position, screen=False)
  
    obj.ViewObject.FontSize = f_size
    obj.ViewObject.TextColor = (255.0, 0.0, 0.0)

    t_l = obj.ViewObject.getBoundingBox().XLength
    t_h = obj.ViewObject.getBoundingBox().YLength
you could even use directly Center property of the BB.

You could organize things using Draft Layers, that could contains different object a part from Draft Objects, i use them to separate things with many "Part..." derived objects, and it work.

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/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

Carlo D, new property to the object can be added via python macro or console but you can't set custom text, description, or any flag to the edge via FreeCAD GUI, that's the problem. Even if you would run pre-config-macro that automatically add new properties for all objects in the project you wouldn't be able connect it with FreeCAD GUI for the user interaction.

There is no property box for edge or face. You have it only for whole object. If you add new property to the object you have it at object level not face or edge level.

Only constraints name is at the edge dimension level and it is accessible for user via FreeCAD GUI. I was thinking about pre-config-macro too but without FreeCAD changes for woodworking macro rather can't do more.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
zohozer
Posts: 119
Joined: Mon Jul 28, 2014 8:35 pm

Re: Woodworking - getDimensions

Post by zohozer »

dprojects wrote: Sun Jan 23, 2022 8:46 pm Carlo D, new property to the object can be added via python macro or console but you can't set custom text, description, or any flag to the edge via FreeCAD GUI, that's the problem. Even if you would run pre-config-macro that automatically add new properties for all objects in the project you wouldn't be able connect it with FreeCAD GUI for the user interaction.

There is no property box for edge or face. You have it only for whole object. If you add new property to the object you have it at object level not face or edge level.

Only constraints name is at the edge dimension level and it is accessible for user via FreeCAD GUI. I was thinking about pre-config-macro too but without FreeCAD changes for woodworking macro rather can't do more.
Maibe a developer can take a look into this and add the necesary functionality.
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Woodworking - getDimensions

Post by onekk »

You a re referring to this?

dprojects wrote: Mon Jan 17, 2022 10:22 am In our time dimension, I mean FreeCAD, You can't add custom description (custom text) for object. You can do it in python, add custom property to existing object, but there is no GUI for that at FreeCAD during designing furniture.

Also You can't add custom text to the edge except "constrain name".
A Face or an edge is a "building component" of a Solid, not an object with a proper "life".

This is not a thing you could change from the actual way, is a completely different way of thinking things, as a solid is defined as a unique object not a "sum of components".

You could store some components as separate objects, and maybe name them, if they share same placement, they are shown in same place.

You could add some arrow that points to a position, and name them.

But I doubt that a CAD will permit you to name a "building component".

Maybe there is some "basic comprehension" that lacks about modelling.

See under Topology what are Faces, Edges in respect to a Solid.

https://wiki.freecadweb.org/Topological_data_scripting

When you model, you could make a wire, then make a face using the wire, then extrude the face to make a solid, and retain all the intermediate objects, simply use copy of them.


You have three objects, so you must have a way to quickly switch between the "whole view" and the detail view, for this you could use Layers.

You have two layers, "Solids" and "Components", maybe more than one, each one will show what you need and could have a proper Name (or better Label shown in the combo view)

But this is a design choice, you could make a macro or a whole program to model things, and make it behave in whatever manner you want. it is simple matter of time and work.

I have done similar work and users are satisfied with the way of work, at the end of the program run only the "final solid" is shown, but there are Layers that could be activated to show the "building components", in my case, wires or subcomponents, I have done some work to carve fretboards, using a semicircular carve following the curved profile of fretboard, and the final solids are "frets holes" as they are the solid passed to the CNC program to carve.

Buy selecting a Layer named "Fretboard" user could show the fretboard itself and selecting another Layer named "Construction" it could show "building dimensions" like fretboard curvature, fretboard length and arrows naming each solid as "fret n 1" and so on, each fret has a proper "Label" (Name property for some solids is assigned by FreeCAD so you could alter only Label that is shown in comboview).

As said Draft layers could divide the view and make it less crowded, and maintain an high level of flexibility, you could set a property to Hide or Shown them so what is shown at the end of the "generating program run" is a design choice.

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/
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Woodworking - getDimensions

Post by onekk »

zohozer wrote: Sun Jan 23, 2022 10:57 pm Maibe a developer can take a look into this and add the necesary functionality.
Necessary functionality for what, having for each solid "sub component" a way to assign a "label".

Have you a little idea of what will be the increasing complexity of such "necessary functionality".

In a simple cube you have 6 Faces, 8 Vertexes, 12 Edges, (hoping to have counted right), for each cube you have to add 26 Property that have to hold names for each component.

It is simple a "no go" as usually there is no need to name things.

If you want to show all the components, it is better to make all these points as discrete objects (only if they are needed) and have a mean to hide them when not useful, there is already Draft layer that could supply this behaviour, and is used in the Arch WB if I didn't go wrong, with Annotations to make such type of things.

Maybe some efficiency could be improved, probably the "workflow is not correct" and some other tools have to be used instead of Part and Part Design.

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/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

onekk wrote: Mon Jan 24, 2022 8:45 am In a simple cube you have 6 Faces
Only 6 faces? You wish ;-) When I was testing the edgeband feature I came across array with only 6 cubes and it returns 36 faces array. I get all of them but there was no room at spreadsheet ;-) so I print only 6 first for base object.

Nobody wants to totally redesign FreeCAD code architecture. If something is too hard to implement for FreeCAD developers, it can be discussed. There are billions ways to achieve desired results.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Woodworking - getDimensions

Post by onekk »

dprojects wrote: Mon Jan 24, 2022 8:07 pm Only 6 faces? You wish ;-) When I was testing the edgeband feature I came across array with only 6 cubes and it returns 36 faces array. I get all of them but there was no room at spreadsheet ;-) so I print only 6 first for base object.
A part that 6 x6 = 36 so faces count is right. :D

Spreadsheet when using a Macro could be not so useful, I usually tend to use Python ConfigParser that parse INI files, old, but "human readable" and it could be filled with comments, so it could be used in two ways, as input and even as an archive, if it is correctly taylored you could even use it as a persistence object saving GUI choices.
dprojects wrote: Mon Jan 24, 2022 8:07 pm Nobody wants to totally redesign FreeCAD code architecture. If something is too hard to implement for FreeCAD developers, it can be discussed. There are billions ways to achieve desired results.
Yes and not the point is how much is the need to store "subobjects data" for the average user of FreeCAD.

Faces colors, are already managed by the Coin3D part as DiffuseColor (provided my memory is working), and I suppose that similar mechanism will work for edges too.

Some time ago there were a discussion about introducing a sort of persistence for big amount of data using a sqlite database in the FCstd file, but sadly my "proposal" was not shared by many developers, this could be a viable way if TNP was resolved, as you could use the "internal unique face representation" that I wish "TNP mitigation" will offer to refer to a specific Face or maybe even Edge.

sqlite3 is a standard python library so no need to reinvent the wheel, only permit to add a file to the FCstd "directory structure", as FCstd files are simply "zipped directories" with extensions modified like OpenOffice files, if you rename a FCStd file with a zip extension you could inspect what is present in the file (make a copy as it is not guaranteed that a modified file will be opened, some checks are done and the format is not clearly doumented yet.)

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/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

onekk wrote: Tue Jan 25, 2022 9:25 am Spreadsheet when using a Macro could be not so useful, I usually tend to use Python
Not really. Only developers are willing to use python, console or macro. Normal user are more willing to use GUI. If no GUI no feature.
Spreadsheet is golden egg in FreeCAD. FreeCAD without it would be very limited. I was thinking to use Spreadsheet as settings. You can link to cells, so You can even set there costs. This is great extension for objects properties that not exists at FreeCAD.


onekk wrote: Tue Jan 25, 2022 9:25 am Faces colors, are already managed by the Coin3D part as DiffuseColor (provided my memory is working), and I suppose that similar mechanism will work for edges too.
Yes, there are many inconsistency in the FreeCAD. The color for faces is stored not in face but somewhere else, spreadsheet width and other decorations are stored not in cell object but somewhere else, there is no even spreadsheet max width or max column number. This not help coding. For sure redesign code architecture would be needed at FreeCAD but maybe there are more important things to implement. Nobody wants to touch it if it works.

Regarding grain direction this could be for example selection at object level. You can describe grain direction just by "no grain" or "grain direction along short edge" or "grain direction along long edge", in practice there is no more options for that. So it is easy to assign value for each selection like 0, 1, 2. If they implemented possibility to add color to the face, so maybe they are thinking about adding material, texture that contains grain. The 3D model would look much better then. Who knows. Time will show.

Just to let you know I just added support for pilot holes and countersinks. The dowels were supported earlier. So now you can do something like that:
Image

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Woodworking - getDimensions

Post by onekk »

dprojects wrote: Tue Jan 25, 2022 7:39 pm

Not really. Only developers are willing to use python, console or macro. Normal user are more willing to use GUI. If no GUI no feature.
Spreadsheet is golden egg in FreeCAD.
Yes and no, if you are doing a WB it your responsibility to make proper GUI actions for users.

I could not see a way to do this sort of thing without programming in some way FreeCAD.
dprojects wrote: Tue Jan 25, 2022 7:39 pm
Yes, there are many inconsistency in the FreeCAD. The color for faces is stored not in face but somewhere else, spreadsheet width and other decorations are stored not in cell object but somewhere else, there is no even spreadsheet max width or max column number.



Are you aware than FreeCAD has two engines (as many CAD around)

- a geometric / modeling engine that is responsible to create solids (Faces Edges and surfaces are sub components of a solid)

- a visualization engine that will show solids in space (your monitor) but as the monitor us 2d you have to set some minir thing thing like persoective dustortion and so on.

Colir is not a property if a geometric object, is related to vusualization part.

how to manage such integration could be improved, but it is not a flaw in my opinion.

You could manage such things youself managing your create object properly addressing these two parts.

Obj and ViewObject , it is in the first introductory part of the documentation, and from what I know is the same in many other CAD scenegraph (Coin3D) representation is dufferent from (geometric engine) how it us exposed to the user is managed in diffrent ways.

there coul be improvements for sure and I think someone us working on it.

Maybe creating a new thread were duscussing things probably in "Developer" section under "Discussion" will a proper place where some developer could note and explain more better things.

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/
zohozer
Posts: 119
Joined: Mon Jul 28, 2014 8:35 pm

Re: Woodworking - getDimensions

Post by zohozer »

onekk wrote: Mon Jan 24, 2022 8:45 am
Necessary functionality for what, having for each solid "sub component" a way to assign a "label".

In a simple cube you have 6 Faces, 8 Vertexes, 12 Edges, (hoping to have counted right), for each cube you have to add 26 Property that have to hold names for each component.
You misunderstood the request. And yes, it is necessary because otherwise you can't determinate the grain direction of the
PART. Nobody asks to add a property for vertexes, lines, etc. but one property/part that indicates the grain direction like described in this pictures. And since other CAD softwares have this feature I think it is useful and practical to have such an information. This information is compliant with the IFC specifications so maybe mr. Yorik can take a look into this?

You simply can't do proper furniture design without this feature.

Image

P.S. Since we are talking here, others are taking action. Autodesk just added such functionality in the latest Fusion360 update.


In the Nesting & Fabrication extension, you’re now able to control material grain in this release. Every material has a grain, but this is especially important for anyone working with wood, as it allows you to aesthetically align your parts. Simply set the component and sheet grain directions and watch the Nest Studies take care of the rest. Don’t forget, the Nesting & Fabrication Extension is associative, so any adjustments to component or material grain are consumed by the nests, minimizing any rework.
Image
Post Reply