Woodworking - getDimensions

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

Petert wrote: Sat Nov 20, 2021 8:26 pm Why would I care about an edge? I am not sure you really understand what is requested.
For single chipboard made from Cube you can get 3 dimensions just by asking single object for 3 values: Width, Height, Length.
If you want the same for chipboard made from Sketch and Pads you have to ask 2 objects. You have to ask Sketch for 2 dimensions (Constraints with random names) and Pad for one dimension (Length). But the problem is you have to know where the right Pad object for that Sketch is and if this is add or cut.

This way don't make any sense. Sorry.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
Petert
Posts: 124
Joined: Tue Dec 01, 2015 9:27 pm

Re: Woodworking - getDimensions

Post by Petert »

Never mind, moving on.
I am a refugee from Fusion 360. Switched over to FreeCAD and am spreading the word. After years of very little progress I switched again to another solution. I wish you all the best!
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

Petert wrote: Sat Nov 20, 2021 9:08 pm Never mind, moving on.
Are you just sad or very sad? If you are very very sad and cry sometimes ;-) I can write small piece of code to make listing with Pads and maybe Sketches too. FreeCAD not allow for anything more, so far. But this may help you.

I looked into that and I got listing with Pads:

Code: Select all

if obj.isDerivedFrom("PartDesign::Pad"):
        FreeCAD.Console.PrintMessage(str(obj.Label)+"\t"+str(obj.Length))
	FreeCAD.Console.PrintMessage("\n")
but the FreeCAD Sketch object is little messy and I need to figure out what kind of properties are available there and which ones will be useful. I am pretty sure there are no any connection marks with Pads but maybe I got some x, y dimensions.

I will try to look into that about evening because right now I am little busy at home with dinner. Stay tuned.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

So, I have small piece of code for testing purposes like this:

Code: Select all

for obj in FreeCAD.activeDocument().Objects:

	if obj.isDerivedFrom("Sketcher::SketchObject"):
		for b in obj.InList:
			sk = b.Group[0]
			pd = b.Group[1]
			FreeCAD.Console.PrintMessage(   str(sk.Label) + "\t"   )
			FreeCAD.Console.PrintMessage(   sk.getDatum(9)     )
			FreeCAD.Console.PrintMessage(  "\t"   )
			FreeCAD.Console.PrintMessage(   sk.getDatum(10)     )
			FreeCAD.Console.PrintMessage(   "\n"   )
			FreeCAD.Console.PrintMessage(   str(pd.Label)  + "\t"   )
			FreeCAD.Console.PrintMessage(  str(pd.Length)    )
			FreeCAD.Console.PrintMessage(   "\n"   )

		break
and here is the output generated for first Sketch (folder named "links"):

Code: Select all

Sketch001	500 mm	2400 mm
Unnamed	100 mm
but the question is if the 3 dimensions are correct? this is what we are looking for or we have to search somewhere else?
btw: I saw that not all Sketch folders have the same structure, also many Pads are in the main folder.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

I just added support for Pads and Sketches: https://github.com/dprojects/getDimensions
Also there are some new demos (one is for pads, it is harder to create furniture like this but is more flexible later):
https://github.com/dprojects/getDimensi ... aster/Demo

You are welcome to test it. Thanks, Good Luck!

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

Petert wrote: Thu Nov 18, 2021 8:34 am kastSterre.FCStd
Where did You disappear Petert? Are You fine?

I use Ubuntu 20.4 LTS and there is FreeCAD version 0.18.4 as default, so the file wasn't readable for me before, many unnamed object, one big mess. Yesterday when I was testing new test cases for Pads I opened Your file again but this time with FreeCAD 0.19.3 AppImage and I saw that everything looks fine, so looks like there is no backward compatibility at FreeCAD.

The TechDraw page for You project is looking good, almost all was listed, except two objects: Pad005 and Pad020, as I remember correctly.

The Pad020 is dowel made from Sketch, but dowels are not supported. More easy would be support dowels made from cylinders not from Sketch (there is no control of Sketch shape). However, I have mixed feelings about supporting furniture accessories. There are too many of them and they are too complicated to calculate.

The Pad005 is like two boards in one. I can't open Sketch005, and even anyone from Your project, because FreeCAD 0.19.3 AppImage not allow for that, it reports incorrect Sketch for each one. However, all other Pads works fine with the macro. At the Pad005 did You create mirror transformation directly on Sketch and then Pad two Sketches as one Pad?

For Pad005 and Pad020 there is no such thing like .Profile[0].Shape.OrderedEdges there are Edges and Constraints but this is not good place to get dimensions, they are not sorted, random values, even for rectangular shapes at Sketch.

If You want them also listed, only You can do is to add them manually to toCut spreadsheet and add "keep updated" option to TechDraw report toPrint. Also You can change the Sketch005 to get correct Pad005 structure. Good Luck and don't give up so quickly !

Thanks
Darek
github.com/dprojects

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

Re: Woodworking - getDimensions

Post by onekk »

dprojects wrote: Mon Dec 20, 2021 12:21 pm so looks like there is no backward compatibility at FreeCAD.

There is not backward compatibility in FreeCAD, and to add some other note, if you open a file created with an old version, modify it and try to reopen with the "original old version" it is almost sure that there were problems.

One of the main reasons of AppImages, is that many Linux distributions use old versions of software that are frozen at a certain point usually when the "release freeze" appears (Usually in Debian and Ubuntu, when a release is near his release, no version increment in software is possible, sadly this freeze is not even very near the release date as it is simply a term on which developer should freeze versions and start to catch bug for the next release, so time could vary from some days to some months.

Ubuntu is more quick, but they are using "unstable version" of Debian to make the "release" so mileage may vary.

So it may happen that for a recent version of a distribution you have a very old version of software, maybe for OpenOffice/LibreOffice you will have a farily recent version, but for some software there are "very old versions".

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: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

onekk wrote: Mon Dec 20, 2021 12:38 pm There is not backward compatibility in FreeCAD, and to add some other note, if you open a file created with an old version, modify it and try to reopen with the "original old version" it is almost sure that there were problems.
Indeed, I saw it when I was trying to reopen the test case created with new version, many unnamed objects and one big mess. It was little shock to me the FreeCAD so quickly put to the trash the backward compatibility, there is not so big gap between the 0.18.4 and 0.19.3, regarding the numbers, only +0.01.

I would stay with 0.18.4 but the feature Array Polar has separate button and also new icon in folder Tree. So, I had to create the test cases with new version, to look good at screenshots.

Also I tested the PPA version 0.20 and I don't like the FreeCAD direction, looks like they have no idea what they are doing. They left "combo box" what is f* annoying thing and connect it with "properties box" what is the most useful thing, wtf? So, You can't have folder tree at the left, properties on the right and long log console at the bottom? You have to have combo box and properties at the same long side? So where is place for console? at the right? small window? or maybe switch between tree and properties all the time in small box and fighting with tasks box all the time?

Thanks
Darek
github.com/dprojects

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

Re: Woodworking - getDimensions

Post by onekk »

from 0.18.4 to 0.19.3 there are some times passed as FreeCAD versions are not precisely point releases.

Usually 0.18 is a version 0.19 is not an incremental version is a new release, with many improvements, 0.19.3 is four "big increment" from 0.18.4 0.19, 0.19.1, 0.19,2, 0.19.3.

And using distribution supplied version is not the "best way" to use FreeCAD, according to many users and many developers that write on this forum.

The other part of the post, are not very comprehensible to me, for me console is "Python console", so it is at bottom if you activate it using Panels.

combobox is "TreeView" plus the Tabs (Data and View)?

But I use FreeCAD mostly through Scripting, so I "code" most of my modelling work, so GUI is not the best part of FreeCAD i know, so I'm not very expert of GUI to make some decent advices.

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: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Woodworking - getDimensions

Post by dprojects »

onekk wrote: Mon Dec 20, 2021 7:02 pm from 0.18.4 to 0.19.3 there are some times passed as FreeCAD versions are not precisely point releases.

Usually 0.18 is a version 0.19 is not an incremental version is a new release, with many improvements, 0.19.3 is four "big increment" from 0.18.4 0.19, 0.19.1, 0.19,2, 0.19.3.
Yea, maybe You are right, I don't trace FreeCAD so much and I don't know what there is going on with each number. However, it was big shock to me because I was learned that backward compatibility is important thing.
onekk wrote: Mon Dec 20, 2021 7:02 pm And using distribution supplied version is not the "best way" to use FreeCAD, according to many users and many developers that write on this forum.
You will never make everyone happy, there are so many hardware, OS, even software, but yes You are right, this should be tested with official stable version downloaded from official source. But in the past there was no AppImage and I even didn't know this exists. Yea, I am up to date ;-)
onekk wrote: Mon Dec 20, 2021 7:02 pm combobox is "TreeView" plus the Tabs (Data and View)?
Not really. Combo box was "Tree" + "Tasks". There was also separate bo with "Tree" and separate with objects properties (box when You click object). Now all the thing has been put to the one trash named "combo box" ;-) imagine that? I couldn't believe that ;-) However this is PPA so maybe this will be banned for stable version, I hope so.
onekk wrote: Mon Dec 20, 2021 7:02 pm But I use FreeCAD mostly through Scripting, so I "code" most of my modelling work, so GUI is not the best part of FreeCAD i know, so I'm not very expert of GUI to make some decent advices.
I use FreeCAD only for furniture design, about twice a year, sometimes sometime tools more often. So, I am not familiar with FreeCAD.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply