question

William Proctor avatar image
2 Likes"
William Proctor asked Phil BoBo edited

defining bounding box anchor location

I understand that there is a specific location within a 3D object's bounding box that become the anchor location (for determining the object's location). I believe that is it the lower left corner by default. Is there a way to change the anchor location (like put it in the upper middle location of the box)?

FlexSim 16.0.1
3d shape factors
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

An object's location is stored in the tree by the corner of their unrotated bounding box shown here:

When you select the "Direct Spatials" mode for displaying the object's location, Quick Properties shows you the values that are stored in the tree for the location of the object. If you rotate an object, you'll notice that the object's location doesn't change (only its rotation changes):

The location edit mode in Quick Properties enables you to specify a location based on a certain reference point. For example, if you specify the upper planar midpoint as the reference point, then the location will be shown as (3.69, -1.5, 2) for the object above, instead of the (0, 0, 0) that is its actual location that is stored in the tree. You can then edit the location based on that reference point instead of the direct spatial location.

The object's location in the tree will still be stored as the "Direct Spatials" values, but this option enables you to enter the location based on a certain reference point.

You can also set the location dynamically based on these reference points using the Set Location pick option:

Here, you can specify a reference point similar to the Quick Properties window:

The command setloc() also takes 3 optional parameters. If you do not use these parameters, it sets the location directly, based on the "Direct Spatials" mode. If you use these three optional parameters, it sets the location based on a reference point within the yellow bounding box (as specified by 3 factor values between 0 and 1).

You can also use the command setcenter() to set an object's location based on its center point. This would be the same as setloc with 0.5 for each optional parameter:

  1. setcenter(object, xloc, yloc, zloc);
  2. setloc(object, xloc, yloc, zloc, 0.5, 0.5, 0.5);

direct-spatials.png (281.1 KiB)
direct-spatials2.png (280.8 KiB)
planar-mid-point.png (396.8 KiB)
set-location.png (93.5 KiB)
set-location2.png (219.2 KiB)
· 7
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.