question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked Jason Lightfoot edited

How to draw line between two objects

I am trying to draw line between Queue1 and Queue3

and Queue2 and Queue4

Below is the code I am trying. But not sure how to draw line

Attaching the model for refernce

draw.fsm

FlexSim 20.0.10
drawdraw line
1620216159016.png (31.8 KiB)
draw.fsm (28.9 KiB)
5 |100000

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

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

You need to call drawline() from an On Draw trigger.

Attached is your model, modified to draw a line from Queue1 to Queue2 from within Queue1's On Draw trigger.

draw_1.fsm


draw-line.gif (167.7 KiB)
draw-1.fsm (29.5 KiB)
· 3
5 |100000

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

Arun Kr avatar image Arun Kr commented ·

@SudheerReddy, Similar topic, may be useful. Draw

1 Like 1 ·
Mark S3 avatar image Mark S3 commented ·

Hi@Phil BoBo, if I want to draw column between two objects,How can I achieve this ?These two objects can be anywhere in three dimensions .

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Mark S3 commented ·

Here's a start (references a pointer label to 'otherObject'):

drawtomodelscale(current);
int numsides=4;
double diam=0.2;
Object otherObject=current.otherObject;
Vec3 fromLoc=current.getLocation(0,0,0).project(current.up,current);
Vec3 toLoc=otherObject.getLocation(0,0,0).project(otherObject.up,current);
double theta=Math.degrees(Math.atan2(toLoc.y-fromLoc.y,toLoc.x-fromLoc.x));
fglRotate(theta,0,1,0);
Vec3 between=toLoc-fromLoc;
double theta2=Math.degrees(Math.asin(toLoc.z/between.magnitude));
drawcolumn(fromLoc.x,fromLoc.y,fromLoc.z,numsides,diam,diam,between.magnitude,0,90-theta2,0,255,255,100);

return 0;
0 Likes 0 ·
Jason Lightfoot avatar image
2 Likes"
Jason Lightfoot answered

I added a shape to your model whose onDraw trigger draws the line. It isn't currently possible to draw a line once and have that become an object in its own right that automatically drawn. The line needs to be drawn for every frame - hence the use of the onDraw trigger that fire's every time the screen is drawn.

draw_jl.fsm


1620221931039.png (28.8 KiB)
draw-jl.fsm (29.3 KiB)
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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