question

MaxKMadiath avatar image
0 Likes"
MaxKMadiath asked Jason Lightfoot commented

Object properties Import and export from CAD

Is it possible to import and export conveyor data from Flexsim? We are using tools for layouts in AutoCAD the BHS system and there is an export function to it I want it to import that data to Flexsim in order to avoid drawing models. The same logic is working with other software. Please help.

FlexSim 23.1.3
usd stageautobuild conveyorscad snap pointsimport and exportusd file format
· 1
5 |100000

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

Carter Walch avatar image Carter Walch commented ·

Hi @MaxKMadiath, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot commented

Please see this post on creating conveyors based on CAD snap points.

You may be able to avoid some of the finalizeSpatialChanges calls if you're setting properties using setProperty() on an object you've created. (Suggest using Object.create() rather than createinstance() and setProperty() over setvarnum() calls).

The may find new USD format import/export function useful. At some point you may be able to leverage version 23.2's USD Stage for collaborative layouts with other content creation tools that support Omniverse USD Stages.

· 24
5 |100000

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

MaxKMadiath avatar image MaxKMadiath commented ·

Thanks @Jason Lightfoot I have attached the export data from cad is it possible to draw a conveyor with it "BHS Flexsim.xls"? so I can avoid redrawing it in flexsim. If so can you please explain how to do it? I am new to Flexsim ThanksBHS Flexsim.xls

0 Likes 0 ·
bhs-flexsim.xls (47.5 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·

With your data pasted into a global table called ConveyorRawData:

1691755226271.png

I then created another table called ConstructorData and populated it using this expression:

Table.query("SELECT Name, 1.335 AS Radius, Angle AS SweepAngle, CASE  WHEN Angle=0 THEN 'Conveyor::StraightConveyor' ELSE 'Conveyor::CurvedConveyor' end AS Class, 1 AS Width, ARRAY([Start-X]/1000,[Start-Y]/1000,[Start-Z]/1000) AS StartLocation, ARRAY([Mid- End-X]/1000,[Mid- End-Y]/1000,[Mid- End-Z]/1000) AS EndLocation, Speed FROM ConveyorRawData").cloneTo("ConstructorData")

This intermediate step is just so that it's easier to check values. I've guessed how to interpret the raw data - I may be wrong.

Then constructing the model is done by running:

Table.query("INSERT INTO Objects() (Name, Radius, SweepAngle, Class, Width, StartLocation, EndLocation, Speed) SELECT Name, Radius, SweepAngle, Class, Width, StartLocation, EndLocation, Speed FROM ConstructorData")



0 Likes 0 ·
1691755226271.png (22.3 KiB)
MaxKMadiath avatar image MaxKMadiath commented ·

@Jason Lightfoot Thanks the radius is 1335 for the curve can you please share any video of how to do it t as I am new to flexsim Please? Thanks

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·
I updated the scripts to use the radius.
0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath commented ·

@Jason Lightfoot Thanks. Is this tutorial will work for the latest flexsim https://www.youtube.com/watch?v=CDgMKt15D-4&t=0s

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·
Yeah I just copy pasted from excel and ran the two scripts I posted, but you can follow that video pretty much - some of the guis will be out of date for a start.
0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath commented ·

@Jason Lightfoot Thanks what do u mean by " I then created another table called ConstructorData and populated it using this expression:" Do you have any latest video or tutorial links for this as I can't make it work?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·
Did you first create a table called ConveyorRawData with your data pasted in to match the format shown in the image?

If so, then just add another GlobalTable and name it ConstructorData. Then run the first expression in a script console.

0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath Jason Lightfoot ♦ commented ·

Thanks, it worked fine except for the curve. and how i can select Beltconveyor by default.construct.jpgtable.jpgflexsim.jpg

0 Likes 0 ·
flexsim.jpg (479.6 KiB)
table.jpg (715.5 KiB)
construct.jpg (828.0 KiB)
Show more comments
MaxKMadiath avatar image MaxKMadiath commented ·

CAD model.dwgDrawing2_Rev_Baggage Simulation.xlsx I have added the cad model and flexsim model. I have attached the cad model as well for your review Thankscad-model.pngflexsim.png

0 Likes 0 ·
cad-model.png (221.6 KiB)
flexsim.png (325.8 KiB)
cad-model.dwg (253.5 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·
Can you add the FlexSim model?
0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath Jason Lightfoot ♦ commented ·

Test 1.fsm@Jason Lightfoot Please fidn attacched file as you requested. There is an issue with the curve not matching as per the global table. Please help. Thanks

0 Likes 0 ·
test-1.fsm (40.3 KiB)
Show more comments
Show more comments
MaxKMadiath avatar image
0 Likes"
MaxKMadiath answered Jason Lightfoot commented

It's having some issues pls find the attached can you please make the script so that width of the conveyors needs to be taken from Excel? Also is it possible to add PLC and power data to each conveyor from Excel?


test-4.fsm (43.7 KiB)
· 6
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
I checked a few conveyors and they look to match the data, so I think your data is wrong.
0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath Jason Lightfoot ♦ commented ·

thanks, i will check it again Also is it possible to add PLC and power data to each conveyor from Excel?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·
Anything in a table can also be written as a label to an object. The script required will depend on the formatting of your data.
0 Likes 0 ·
Show more comments
MaxKMadiath avatar image
0 Likes"
MaxKMadiath answered Jason Lightfoot edited

@Jason Lightfoot Thanks for your effort on this but still Curve has the issue. Please find the attachment.

Test 3.xlsx
Test 3.fsmTest3.dwg


test-3.fsm (49.4 KiB)
test-3.xlsx (13.8 KiB)
test3.dwg (2.8 MiB)
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

I forgot to tell you the sweep angle is directional - where clockwise is negative and anticlockwise is positive. The source data needs changing to reflect that.

0 Likes 0 ·
MaxKMadiath avatar image MaxKMadiath Jason Lightfoot ♦ commented ·

Thanks It worked. If I want to add a photocell for some conveyors how can it be done in Excel? Is it possible to save user commands as a file so I can use it in other Flexsim files.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ MaxKMadiath commented ·

Sure - for photoeyes you only need 3 fields:

Table.query("INSERT INTO Objects() (Name, Class, Location)  SELECT Name,Class,Location FROM temp");

Where the class is Conveyor::PhotoEye.

You can add all the user commands to a user library that you load either on demand or automatically - and have that user library auto-install the commands to your models. Click on this icon: 1693484250292.png

here:

1693484212224.png

Then rename and save the created library:

1693484357880.png

Which will give you this .fsl file:

ArcCommands.fsl

Then either load it from the file menu when needed, or add it to your GlobalPreferences to be loaded when FlexSim starts:

1693484525123.png

Be aware that edits to the commands need to be re-added to the user library and saved again.

0 Likes 0 ·
1693484212224.png (27.4 KiB)
MaxKMadiath avatar image
0 Likes"
MaxKMadiath answered Jason Lightfoot commented

@Jason Lightfoot thanks a lot for your effort There is an issue with the curve. I am attaching the layout and FSM file. Do you have any solution for this?Test 2.dwgTest 2 MK.fsm Thanks a lot in advance 2.xlsx


test-2.dwg (346.2 KiB)
test-2.xlsx (12.8 KiB)
test-2-mk.fsm (44.3 KiB)
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Thanks for finding that - it was a problem with the radius returning negative values.

test-2-mk_radiusFix.fsm

0 Likes 0 ·

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.