FreedCAD 0.12: Part WB Box H/L/W

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
bhorton111
Posts: 17
Joined: Mon Jan 09, 2012 2:40 pm

FreedCAD 0.12: Part WB Box H/L/W

Post by bhorton111 »

For a Box added In the Part WB, where does the Data tab get its Height, Length, Width dimensions from?
If I try:
obj = FreeCAD.ActiveDocument.GER026
shp = obj.Shape
print shp.Height
I get an error as 'Part.TopoShape' object has no attribute 'Height'.
There is a 'Length' attribute but according to the TopoShape API, it's the total length of the edges of the shape.
Brian
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by yorik »

simply:

Code: Select all

obj = FreeCAD.ActiveDocument.GER026
obj.Height
The shape is simply another property of the object. In fact the object contains code that recomputes the shape whenever a parameter changes
wmayer
Founder
Posts: 20320
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by wmayer »

For most primitives such as a box we have a parametric and a non-parametric version. The topo shape you're talking about is the non-parametric version. For the non-parametric object you can only change the whole shape itself but no parameters. Here are some examples to illustrate this:

Code: Select all

# non-parametric
import Part
obj=App.ActiveDocument.addObject("Part::Feature")
obj.Shape=Part.makeBox(10,10,10)
# replace shape
obj.Shape=Part.makeBox(20,10,10)

Code: Select all

# parametric
obj=App.ActiveDocument.addObject("Part::Box")
obj.Length=20.0
obj=App.ActiveDocument.recompute()
obj.Length=10.0
obj=App.ActiveDocument.recompute()
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by jmaustpc »

bhorton111 wrote:For a Box added In the Part WB, where does the Data tab get its Height, Length, Width dimensions from?
If I try:

Werner, I think he means he hit the create box icon on the tool bar in Part WB? If so he would have the parametric shape, unless I am confused :) .

I just tried it (and all that you two guys put here) and it all works as you two have said, as would obviously be the case. 8-)

So Brian, if you mean you clicked the box icon on the tool bar in Part WB, then you will have the parametric version. If that is what you mean, follow Yorik's suggestion or Werner's parametric, but if you used "Part.makeBox" from the command line then you have the NON-parametric version that Werner talks about.

Jim
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by shoogen »

Or maybe look at the 'data' tab in the 'combo view'
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by jmaustpc »

shoogen wrote:Or maybe look at the 'data' tab in the 'combo view'
Yes, but not very helpful or useful, when he would appear to be trying to write a script.
bhorton111
Posts: 17
Joined: Mon Jan 09, 2012 2:40 pm

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by bhorton111 »

Thanks for the clarification. Is there any automatic way to covert a non-parametric shape into an equivalent parametric one?
Brian
wmayer
Founder
Posts: 20320
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by wmayer »

bhorton111 wrote:Thanks for the clarification. Is there any automatic way to covert a non-parametric shape into an equivalent parametric one?
Brian
In general not. You can do it for a handful of geometries like cylinder, cone, plane and a few others but for composed objects like a box it gets much harder.
bhorton111
Posts: 17
Joined: Mon Jan 09, 2012 2:40 pm

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by bhorton111 »

Thanks. Why is a box more complex than a cylinder or cone? I would've thought it would be simpler...
Brian
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreedCAD 0.12: Part WB Box H/L/W

Post by NormandC »

This may be a good explanation, it's quoted from another current topic:
wmayer wrote:FYI, OCC terminology distinguishes between geometry and shape. A geometry is a point, a curve (circle, line, ellipse, ...) or a surface (plane, cone, cylinder, ...). And a shape tells something about the topology. They have vertex, edge, wire, face, shell, solid, compound and the rarely used compound solid. The three shapes vertex, edge and face are the direct topological counterpart for geometries point, curve and surface. For edge and face you can also set the domain if needed. Then wire is a set of connected edges, shell a set of connected faces, a solid is a closed shell and a compound is just a container for arbitrary shapes.
Post Reply