I want to keep an objects size fixed (always 2 x 2 x 2) independently of the zoom used in the view. Is this possible? Kind of what happens with the connections edges.
I want to keep an objects size fixed (always 2 x 2 x 2) independently of the zoom used in the view. Is this possible? Kind of what happens with the connections edges.
An additional comment would be that I don't want the object to be screen-locked, and the it should keep its location in the model (x,y,z).
Hi @Jörg Vogel. Picture the same behaviour that the network nodes have. They have a fixed number of pixels regardless of the view zoom. And they are tied to a space location.
Is it possible to do with a plane or object?
You can get this functionality using the Custom Draw Trigger by adding the following code:
double size = 5.0; int shapeIndex = getshapeindex("fs3d\\Processor\\Processor.3ds"); double scaleFactor = size * viewpointradius(view).value / 100.0; if (viewprojectiontype(view).value == 1) // orthographic projection scaleFactor = size * 10.0 / viewmagnification(view).value; fglScale(scaleFactor, scaleFactor, scaleFactor); drawobject(view, shapeIndex, 0);
That example code draws a Processor shape. You could adjust the getshapeindex() call to draw a different shape. For example, use "fs3d\\General\\Plane.3ds" to draw a plane.
You can adjust the size variable to make it draw bigger or smaller.
Attached is a sample model demonstrating this.
@Jörg Vogel This is EXACTLY what I intended! You are a genious my friend!
Hi @Jörg Vogel is it possible to draw the 3d object (sphere) in the center of the node (like the red one). I tried with the midpoint selection but it won't work, it always generates it from one corner.
Add fglTranslate() calls to translate where the shape is drawn:
double size = 5.0; int shapeIndex = getshapeindex("fs3d\\General\\Sphere.3ds"); double scaleFactor = size*viewpointradius(view).value/100.0; if (viewprojectiontype(view).value == 1) scaleFactor = size*10.0/viewmagnification(view).value; fglTranslate(0.5, 0.5, 0.5); fglScale(scaleFactor, scaleFactor, scaleFactor); fglTranslate(-0.5, -0.5, -0.5); drawobject(view, shapeIndex, 0);
Or modify the shape in a 3D modeling program (such as AC3D) so that the shape is centered on the origin. The general sphere shape is positioned with its corner at the origin, not its center.
7 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved