Main Menu

search

You are here

FreeCAD: working with Multiple Bodies

[last updated: 2024-04-25]
FreeCAD home page
Spreadsheet WB

FreeCAD Python macro's and scripts
Install external workbenches

Meshing with multiple bodies
-----
At this time I'm using FC 20.2


EDIT IN PROGRESS. THE PAGE IS A MESS, INCOMPLETE, SURELY FILLED WITH ERRORS.


Disclaimer: These are mostly an ongoing collection of rough study notes.
---------------

  • In Part Design (and maybe other WB's), it can be useful (or necessary) to separate your drawing into multiple Bodies.
    You might want to do this if:
    • you have a complicated drawing, perhaps an assembly of many parts.
    • you want to apply different "View" settings (color, transparency, etc.) to different parts of your drawing
    • you want to (easily) move one part in relation to the others

    ---------------

  • Context:
    • These notes refer to managing multiple bodies that are created in Part Design WB.
      IMO the only reasonable way to manage this is to use the Spreadsheet WB.

    ---------------

  • Start/Setup:
    • Create a new drawing
      Select the Spreadsheet WB
      Create a new spreadsheet
      Rename the spreadsheet if desired, eg. something simple like "ss".
    • Switch to Part Design WB
      Create a body (rename it if desired), then create a sketch in the body
      draw some shape in your sketch (constrain it if desired, but not necessary for this example)
      pad your sketch into a solid object
    • Create a new body, create a new sketch
      draw a shape, pad it, etc. as before.
    • For purposes of this tutorial,
      create another sketch in this second body, draw some different shape, pad it.

    -------------------------------------------------------------------------------

  • A key concept you must understand: Origin/Axes:
    • Drawing Origin:
      • Every drawing has an origin, that defines its x, y, and z axes. The origin is a point in space,
        and it defines the starting point of the three x, y, and z axes, where x=0, y=0, and z=0.
        The drawing origin is created when you create a new drawing, and cannot be changed.
        You can see the origin/axes of your drawing using View (top menu bar), and scroll down and click "Toggle Axis Cross"
      • The "axis cross" shows you where your Drawing Origin is located,
        as well as the x, y, & z drawing axes.
          Note the Red arrow tip shows direction of the drawing X axis.
          The Green arrow tip shows direction of the drawing Y axis.
          The Blue arrow tip shows direction of the drawing Z axis.

      ----------------

    • Body Origin:
      • When you create a Part Design Body, it will have its own origin/axes.
        You can see it by hovering your mouse over the body listing in the model tree, right-click, scroll down and select Transform.
      • When a body is created, its origin is in the same place as the drawing origin.
      • However you can move a body's origin away from the drawing origin if you want.
        Move the body (move the body origin):
        This will move the body in relation to the drawing origin, and in relation to all other bodies in the drawing.
        • click on the body listing in the model tree
          Properties > Base > Placement > Angle and Position
        • If you change any of these values, then when you position your cursor over the body listing in the model tree,
          and right-click and select transform,
          you will see the position of your new (moved) orig/axes.
        • Notice if you move the body origin in this way, all features/objects in the body also move.
          You are moving the entire body and all its contents in relation to the drawing axis.
          Neither the drawing axis, nor any other bodies in the drawing, are affected.

      ----------------

    • Sketch Origin:

    -------------------------------------------------------------------------------

  • move features in relation to other features in the same body:
    • do this by moving the sketch axis of the feature

    ------------------------------

    ========================================

  • Sketch parameters:
    • Moving a feature with sketch position parameters always tracks the sketch axis
      changing the sketch position parameter for x position, moves the feature in the x direction of the sketch axis.
      The same is true for the sketch axis y and z position parameters -
      they will move the feature in their respective y and z directions of the sketch axis.

    • If you select the XY-plane when you create your sketch,
      then pads (normal) will extend in the Z direction.
      Moving the sketch position using Sketch parameters for x, y, or z axes will still move the feature
      along those same axes of the sketch axis,
      but it will also move the feature in the same x, y, or z axes of the drawing axes.

    • If you select the XZ-plane when you create your sketch,
      then pads (normal) will extend in the -Y direction.
      Moving the sketch position using Sketch parameters for x, y, or z axes will still move the feature
      in those same directions of the sketch axis,
      but moving a feature in the y direction using sketch position parameters
      will move the feature in the +Z direction of drawing axes.
      Finally, moving your feature in +z direction using sketch position parameters
      will move your feature in the -Y direction of drawing axes.

    • If you select the YZ-plane when you create your sketch,
      then pads extend in +x
      using sketch position parameters:
      moving in x sketch direction moves the feature in +grn
      y moves in +blu
      z moves in +x (red)

    ======================================
    explanation/background ...
    Start with your first feature, maybe it's a circle you've padded into a cylinder.
    Select (single click) the sketch of the cylinder in the model tree.
    Notice the Property window opens in lower left of your display.
    Notice the "Attachment" block. Click the little carot arrow to open into Angle, Axis, and Position block.
    Click the carot arrow to open the Position block into x, y, and z
    Click in the z field, enter a value, press enter.
    Enter a large value so you can see the result, or else zoom in,
    but you will see that your cylinder has moved in relation to the drawing axis cross.

      This is kind of a trick. Don't be fooled.
      The drawing axis cross happens to be (at least right now, in this drawing)
      at the same place as the sketch axis for this feature.
      What you've really done is moved the sketch axis of this feature, in relation to the sketch axis of the other feature in your drawing,
      The sketch axis of the block feature is still, since you haven't moved its property attachment, at the same place as the drawing axis cross.

  • Now create a second sketch, and pad it. Note that it must intersect the first feature,
    else you'll get an error for "multiple bodies not supported."
  • Notice that the second feature (perhaps a square you've padded into a block)
    has its base on the plane you selected when you created it,
    while the cylinder has it's base above that plane by the amount you entered into its z property.
  • Summary:
    Use the Sketch Property parameters to move a feature within a body, in relation to other features in the same body,
    always being mindful to not move it out of intersection range.

------------------------------------------

  • Body parameters:
    Select (single-click) the Body entry in the model tree.
    Notice a Property window opens. Click Placement to open into Angle, Axis, and Position.
    Click Position to open into x, y, and z parameters.
  • click in the y field, enter a value, press enter.
    Notice that both the cylinder and block moved in relation to the axis cross,
    but they maintained their orientation and spacing to each other.
  • Open (double-click) one of the sketches.
    Notice the Sketch axis is now different than the drawing axis cross.

    Dimensions/constraints that you enter in editing your sketch will always be in relation to the Sketch axis

    But when you move the entire body with the Body parameters, take especial note that the x, y, and z body parameters that you enter will be in relation to the drawing axis.
    The key thing is that, when you created your sketch to create your body, if you selected the XY plane, then the x, y, and z axes of the sketch axis will be the same as the drawing axis.

    ------------------------------------------

  • Moving bodies in relation to each other:
    • Create your bodies:
      All your bodies will by default be created with their Body Origib (axes) = Drawing Origin
    • Make reference position alias':
      For each body, make alias' in your spreadsheet: [bodyName]Rot, [bodyName]RefX, [bodyName]RefY and [bodyName]RefZ .
      These parameters will set the desired rotation and offsets of your body from the Drawing Origin.
      Initially set all of these = 0.
    • Attach your move/rotate alias' to your body:
      select body in model tree
      in Property > Base > Placement >
      Enter your Rot alias into the Angle field
      in ... > Position,
      enter your ...RefX, ...RefY, and ...RefZ alias' in the x, y, and z position fields.
        Note the ... > Position > Axis field default (if you have defined your Sketch in the X-Y plane) is [0.00 0.00 1.00]
        This is a vector pointing in the z direction. and perpendicular to the sketch plane (ie. the X-Y plane in this example).
        This is the axis around which your body will be rotated.

    • If body origin is NOT the same as the drawing origin:

    -------------

  • Moving features in relation to each other within a body,
    when you may be moving the entire body in relation to the drawing origin:
    • If you have a body, with multiple features, and you may be moving the body in relation to the drawing origin,
      then when you create the features, you shoot yourself in the foot if you constrain/locate them in reference to the drawing origin.

    ---