cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Automating part placement from a file of coordinates

SOLVED
J0EL
Participant

Automating part placement from a file of coordinates

Hi all,

I have some coordinates that I am able to export from another tool to give general component locations, and I'd like to be able to take this file and somehow automate the placement of parts in a blank assembly. Each component could be fixed in place for this, or assembled to a CSYS, if it's eaiser to import a bunch of CSYSs.

I have no problem creating an external script to translate the output of the tool in to any format needed, but I just don't know how best to approach the placment of the parts.

I looked at trail files, but I don't see a way to use actual numbers for XYZ, since the placement is done with the mouse. Even with AutoIT, I don't see a way to assemble a part and then enter XYZ coordinates for placement.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Automating part placement from a file of coordinates


@J0EL wrote:

Hi all,

I have some coordinates that I am able to export from another tool to give general component locations, and I'd like to be able to take this file and somehow automate the placement of parts in a blank assembly. Each component could be fixed in place for this, or assembled to a CSYS, if it's eaiser to import a bunch of CSYSs.

I have no problem creating an external script to translate the output of the tool in to any format needed, but I just don't know how best to approach the placment of the parts.

I looked at trail files, but I don't see a way to use actual numbers for XYZ, since the placement is done with the mouse. Even with AutoIT, I don't see a way to assemble a part and then enter XYZ coordinates for placement.

Thanks


Hi,

if I were you I would use trail files.

 

Below you can find trail file which creates 1 assembly CSYS.

!trail file version No. 1861
!Creo  TM  4.0  (c) 2020 by PTC Inc.  All Rights Reserved.
~ Command `ProCmdDatumCsys` 
!ODUI session starting: Okit widgets are on, Undo/Redo on, Dashboard style off, Tab style on. Feature title : Coordinate System
!ODUI session started.
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Command `ProCmdMdlTreeSearch` 
!%CINo Names Available
~ Open `selspecdlg0` `SelOptionRadio`
~ Close `selspecdlg0` `SelOptionRadio`
~ Select `selspecdlg0` `SelOptionRadio` 1 `Coord Sys`
~ Update `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` `ASM_DEF_CSYS`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputX`
~ Input `Odui_Dlg_00` `t1.OffsetInputX` `110.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputX`
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputY`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t1.OffsetInputY` `210.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputY`
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputZ`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t1.OffsetInputZ` `310.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputZ`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Trigger `Odui_Dlg_00` `t1.OriginPlacement` 2 `0` `type`
~ Trigger `Odui_Dlg_00` `t1.OriginPlacement` 2 `` ``
~ Select `Odui_Dlg_00` `pg_vis_tab` 1 `tab_3`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t3.datum_csys_name` `mycs02`
~ FocusOut `Odui_Dlg_00` `t3.datum_csys_name`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Activate `Odui_Dlg_00` `stdbtn_1`
!ODUI session finished.
!F5(MYCS01)
!Undo: added rec_id 53 type 5304 

ASM_DEF_CSYS ... name of parent CSYS

110.0 ... X-coordinate

210.0 ... Y-coordinate

310.0 ... Z-coordinate

mycs02 ... CSYS name

 

Below you can find trail file which assembles 1 part into assembly.

!trail file version No. 1861
!Creo  TM  4.0  (c) 2020 by PTC Inc.  All Rights Reserved.
~ Command `ProCmdCompAssem` 
< 2 0.118519 178 0 0 100 1920 0 0 1200 13
~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` \
 `file_open`
~ Select `file_open` `Ph_list.Filelist` 1 `prt0001.prt`
~ Trail `UI Desktop` `UI Desktop` `PREVIEW_POPUP_TIMER` \
 `file_open:Ph_list.Filelist:<NULL>`
~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` 
!ODUI session starting: Okit widgets are on, Undo/Redo on, Dashboard style on, Tab style off. Feature title : Component Placement
!ODUI session started.
!%CPSelect any reference for auto type constraining.
~ Activate `main_dlg_cur` `chkbn.ScrLayout.0` 1
!%CPSelect any reference for auto type constraining.
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` `0`
~ Focus `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0`
!%CPSelect any reference for auto type constraining.
~ Select `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` 0
!%CPSelect any reference for auto type constraining.
~ Command `ProCmdMdlTreeSearch` 
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Update `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` `PRT_CSYS_DEF`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect any reference for auto type constraining.
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Focus `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0`
!%CPSelect any reference for auto type constraining.
~ Select `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` 0
!%CPSelect any reference for auto type constraining.
~ Focus `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0`
~ Select `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` 0
~ RButtonArm `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
!%CPSelect any reference for auto type constraining.
~ Command `ProCmdMdlTreeSearch` 
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` ``
~ Open `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList`
~ Close `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList`
~ Select `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` 1 `MYCS03`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect any reference for auto type constraining.
~ Activate `main_dlg_cur` `dashInst0.stdbtn_1`
!ODUI session finished.
!Undo: added rec_id 104 type 5304 

prt0001.prt ... part name

PRT_CSYS_DEF ... part CSYS name

MYCS03 ... assembly CSYS name

 

To avoid CSYS clicking during trail recording I pressed CTRL+F and used Search Tool to select requested CSYS by its name.

 

From my point of view it is very easy to repeat trail file code and put valid information into specific lines. Therefore it is not at all difficult to create any number of CSYS features and assemble any number of  models.

 

Note: Mastering the Nitro-Cell requires some time -AND- Free license of Nitro-Cell enables you to assemble 10 components only.

 


Martin Hanák

View solution in original post

7 REPLIES 7

Re: Automating part placement from a file of coordinates

Creo Notebook (formerly layout).

Based on your post it does not sound like you are exploring the use of the APIs, so Creo has built in functionality through Notebook.

 

You can define the csys mapping in the notebook and then use this for automatic assembly by declaring the Notebook to the assembly and each component requiring automatic assembly. You will need a name for each CSYS and then you can map each assembly csys to that of a component assembled to it.

 

http://support.ptc.com/help/creo/creo_optm/usascii/index.html#page/optm/options_modeler/asm_three_su... 

Re: Automating part placement from a file of coordinates

@J0EL 

 

We can help with this! We offer a tool that automatically assembles models from some input file. 

 

Here is a 2 minute video showing CadActive assembling a V8 engine block: https://vimeo.com/454511001 

 

DM me if you would like to learn more. 

 

Thank you! 

Please enable JavaScript to experience Vimeo in all of its glory. This video shows a V8 Engine Block being created from an Excel input file, functionality that is now a part of CadActive's Automate package.

Re: Automating part placement from a file of coordinates

This is much easier than you can imagine. ... if you use the right tools and approach.

 

I would skip Layout/Notebook.... another layer of stuff to manage and not very flexible for dynamic scenarios.

 

CSYS-to-CSYS is the fastest and most stable way in my opinion.

 

You can do this for FREE using Nitro-CELL... and Excel Tables.

 

Excel Tables easily enable you to connect/import/reference external CSV (or other types) of Files and import them into Excel as a very structured reference -- or you can just enter the data and make a Table out of it directly.  Excel Tables enable a much more dynamic framework for how to automate the flow of data between Excel and Creo for the various operations you want to perform.

 

 

This does require JLINK to be installed with Creo (Also FREE).

 

If you want to be more controlled - you can still do the same with individual commands (instead of using an Excel Table as your reference) .. you can do this:

 

 

But if you are looking for a clean way to assemble content using CSYS references... Nitro-CELL is much easier than AutoIT, Trail Files, Mapkeys or rolling code with VB, JLINK or Toolkit.

 

Hope you find this useful.... have fun!  Let me know if you have any questions.

 

Dave

 

 

Re: Automating part placement from a file of coordinates

Thanks for the info. I will look in to this and give it a try.

 

Not having to hack something together with Autoit or trail files, and reduce the amount of code I would have to write is a great bonus. 

 

Thanks

Joel

Re: Automating part placement from a file of coordinates


@J0EL wrote:

Hi all,

I have some coordinates that I am able to export from another tool to give general component locations, and I'd like to be able to take this file and somehow automate the placement of parts in a blank assembly. Each component could be fixed in place for this, or assembled to a CSYS, if it's eaiser to import a bunch of CSYSs.

I have no problem creating an external script to translate the output of the tool in to any format needed, but I just don't know how best to approach the placment of the parts.

I looked at trail files, but I don't see a way to use actual numbers for XYZ, since the placement is done with the mouse. Even with AutoIT, I don't see a way to assemble a part and then enter XYZ coordinates for placement.

Thanks


Hi,

if I were you I would use trail files.

 

Below you can find trail file which creates 1 assembly CSYS.

!trail file version No. 1861
!Creo  TM  4.0  (c) 2020 by PTC Inc.  All Rights Reserved.
~ Command `ProCmdDatumCsys` 
!ODUI session starting: Okit widgets are on, Undo/Redo on, Dashboard style off, Tab style on. Feature title : Coordinate System
!ODUI session started.
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Command `ProCmdMdlTreeSearch` 
!%CINo Names Available
~ Open `selspecdlg0` `SelOptionRadio`
~ Close `selspecdlg0` `SelOptionRadio`
~ Select `selspecdlg0` `SelOptionRadio` 1 `Coord Sys`
~ Update `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` `ASM_DEF_CSYS`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputX`
~ Input `Odui_Dlg_00` `t1.OffsetInputX` `110.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputX`
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputY`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t1.OffsetInputY` `210.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputY`
~ FocusIn `Odui_Dlg_00` `t1.OffsetInputZ`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t1.OffsetInputZ` `310.00`
~ FocusOut `Odui_Dlg_00` `t1.OffsetInputZ`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Trigger `Odui_Dlg_00` `t1.OriginPlacement` 2 `0` `type`
~ Trigger `Odui_Dlg_00` `t1.OriginPlacement` 2 `` ``
~ Select `Odui_Dlg_00` `pg_vis_tab` 1 `tab_3`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Input `Odui_Dlg_00` `t3.datum_csys_name` `mycs02`
~ FocusOut `Odui_Dlg_00` `t3.datum_csys_name`
!%CPSelect up to 3 references, such as plane, edge, coordinate system, or point to place coordinate system.
~ Activate `Odui_Dlg_00` `stdbtn_1`
!ODUI session finished.
!F5(MYCS01)
!Undo: added rec_id 53 type 5304 

ASM_DEF_CSYS ... name of parent CSYS

110.0 ... X-coordinate

210.0 ... Y-coordinate

310.0 ... Z-coordinate

mycs02 ... CSYS name

 

Below you can find trail file which assembles 1 part into assembly.

!trail file version No. 1861
!Creo  TM  4.0  (c) 2020 by PTC Inc.  All Rights Reserved.
~ Command `ProCmdCompAssem` 
< 2 0.118519 178 0 0 100 1920 0 0 1200 13
~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` \
 `file_open`
~ Select `file_open` `Ph_list.Filelist` 1 `prt0001.prt`
~ Trail `UI Desktop` `UI Desktop` `PREVIEW_POPUP_TIMER` \
 `file_open:Ph_list.Filelist:<NULL>`
~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` 
!ODUI session starting: Okit widgets are on, Undo/Redo on, Dashboard style on, Tab style off. Feature title : Component Placement
!ODUI session started.
!%CPSelect any reference for auto type constraining.
~ Activate `main_dlg_cur` `chkbn.ScrLayout.0` 1
!%CPSelect any reference for auto type constraining.
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` `0`
~ Focus `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0`
!%CPSelect any reference for auto type constraining.
~ Select `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` 0
!%CPSelect any reference for auto type constraining.
~ Command `ProCmdMdlTreeSearch` 
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Update `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` `PRT_CSYS_DEF`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect any reference for auto type constraining.
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
~ Focus `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0`
!%CPSelect any reference for auto type constraining.
~ Select `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` 0
!%CPSelect any reference for auto type constraining.
~ Focus `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0`
~ Select `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` 0
~ RButtonArm `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` `0`
!%CPSelect any reference for auto type constraining.
~ Command `ProCmdMdlTreeSearch` 
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.assem_ref_represent.l0.s0` ``
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` `0`
~ Trigger `ScrLayout.0.0` `PH.L.S.l0.comp_ref_represent.l0.s0` ``
~ Open `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList`
~ Close `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList`
~ Select `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` 1 `MYCS03`
~ Activate `selspecdlg0` `EvaluateBtn`
~ Activate `selspecdlg0` `ApplyBtn`
~ Activate `selspecdlg0` `CancelButton`
!%CPSelect any reference for auto type constraining.
~ Activate `main_dlg_cur` `dashInst0.stdbtn_1`
!ODUI session finished.
!Undo: added rec_id 104 type 5304 

prt0001.prt ... part name

PRT_CSYS_DEF ... part CSYS name

MYCS03 ... assembly CSYS name

 

To avoid CSYS clicking during trail recording I pressed CTRL+F and used Search Tool to select requested CSYS by its name.

 

From my point of view it is very easy to repeat trail file code and put valid information into specific lines. Therefore it is not at all difficult to create any number of CSYS features and assemble any number of  models.

 

Note: Mastering the Nitro-Cell requires some time -AND- Free license of Nitro-Cell enables you to assemble 10 components only.

 


Martin Hanák

View solution in original post

Re: Automating part placement from a file of coordinates

Thank you Martin, this is going to work best for me since I can programmatically generate these.

Re: Automating part placement from a file of coordinates

YES - there is a limitation on the amount of data that can be processed with the FREE version of Nitro-CELL

 

But for most circumstances, the FREE version is quite useful and can be easily mastered 3-minutes at-a-time with all the video help available online - over 270 of them to watch as examples / overviews.

 

Many customers alter their workflow to setup multiple executions to process larger amounts of data.  You can always request a FULL working Demo License to completely vet out your automation needs - and obviously we hope that leads to a purchase (multiple duration options through the software).

 

Oh... Don't forget CREOSON (Open Source Creo Automation) is out there - which has no limits if you are looking to code something in your language of choice... That is much better option than Trail Files (more control - the ability to introduce logic into the process).

 

Hope all of this is helpful ... Best of Luck!

 

Dave

Announcements