Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

auto assembly

bucky

New member
I have a directory full of vrml files that I am bringing in to an assembly in pro e. They are all assembled bydefault constraintin the component placement dialogue box. The only thing that changes is the name of the file being assembled. I created a mapkey that does all the common commands up to selecting the file name.From there I have to search the directory for the next part and place it in the assembly.


I would like to automate this.Is there a way to write a script/mapkey/trailfile etc...to assemble everything froma directory, assembled at the default coordinate system without handselecting each file name or retyping these long file names? Drag and drop from Windows explrer does not work because these are .vrml files. thanks
 
You can do this with a batch and trail file.
Here is an example for assembling parts.


Create folder proetrail and copy assytrail1.txt, assytrail2.txt and runtrail.bat to this folder.
Create subfolder proetrail\proeparts and copy your parts to this folder.


Create a trail file that opens an assembly from the same folder as your parts
and assemble one part using the default contraints.
Then save and exit proe.


Rename the trail file to assytrail.txt and move to folder proetrail.
You now have to split the trail file into 2 files:- assytrail1.txt and assytrail2.txt


assytrail1.txt contains all lines up to and including the line
1 `partname.prt`
Delete `partname.prt` but leave the 1. (The cursor should be on the same line)
Save the file.


assytrail2.txt contains all lines below
1 `partname.prt`
Save the file.





This is runtrail.bat
************************************************************ ******************
@echo off
::Create assembly file from parts


set CONTINUE_FROM_OOS=true
for %%i in (%CD%\proeparts\*.prt*) do (
echo. `%%~ni.prt`>%%~ni.txt
copy assytrail1.txt+%%~ni.txt+assytrail2.txt %%~ni.tmp >nul
del %%~ni.txt
)


echo Running ProE


for %%i in (*.tmp*) do call :process %%i


exit


:process


set partname=%1
set trailname=%partname:.tmp=.txt%
move /y %partname% %CD%\proeparts\%trailname%
echo. Processing %partname%
cd %CD%\proeparts
call C:\yourproefolder\proe2001.bat %trailname% -g:no_graphics pro_wait
del %trailname%
cd..\
************************************************************ ******************


The batch file creates a trailfile for each part by combining assytrail1.txt, partname and assytrail2.txt.
proe2001.bat then uses the created trailfile to assemble each part.


For vrml files you will need to amend the batch file and change the 2 lines that contain .prt to .wrl
you will also need to change c:\yourprofolder\proe2001.bat to suit your system.


Open the assembly you created and delete the part added, then save the file and exit proe.


Run the batchfile runtrail.bat


You should now have an assembly that contains all you parts.





Hope this helps.
 
Thanks alot for the info. I am not as advanced as I would like to be in proe so the first thing I did was cut and paste and of coursemy trail files may not have workedexactly becauseof different directories etc.... You however helped immensely by getting me started on the right track and as of today I can now assemble things automatically in pro e by running a batch file and the script this will save me a lot of time!!!!!! Thanks a million!!!
 
hey doronron1


i tried procedure you mentioned above; but not getting it right. i am attaching the zip file with the trail files and .bat fiel and also the parts and assembly.


please check for ones and tell me where iam going wrong.


the work you did is really interesting and i want to learn from you.


your little help will be verymuch of use to me


thanks in advance


2009-07-24_065240_proetrail.zip
 
Sanjeevkar,


Try removing the 2 spaces from the last line in assytrail1.txt. If that does not work I don't know what else to suggest.


I cannot test any of your files as I am still using Proe2001.
 
thanks doronon


i'll try it again


and i have 2001 and will send you again ifthe above suggetiondoes not work


i won't leave you on this
smiley2.gif
 
I had some problems with this also and i cant remember everything we did but here are some additional comments maybe this will help?
Look at the red statements below. You did everything correct, but the code adds the incorrect naming convention to the file names.<?:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" />


You can do this with a batch and trail file.
Here is an example for assembling parts.


Create folder proetrail and copy assytrail1.txt, assytrail2.txt and runtrail.bat to this folder.
Create subfolder proetrail\proeparts and copy your parts to this folder.


Create a trail file that opens an assembly from the same folder as your parts
and assemble one part using the default contraints.
Then save and exit proe.


Rename the trail file to assytrail.txt and move to folder proetrail.
You now have to split the trail file into 2 files:- assytrail1.txt and assytrail2.txt


assytrail1.txt contains all lines up to and including the line
1 `partname.prt`
Delete `partname.prt` but leave the 1. (The cursor should be on the same line)
Save the file.


assytrail2.txt contains all lines below
1 `partname.prt`
Save the file.





This is runtrail.bat
************************************************************ ******************
@echo off
::Create assembly file from parts


set CONTINUE_FROM_OOS=true
for %%i in (%CD%\proeparts\*.prt*) do (


This code above collects part name, but the line below adds .prt to xxxxx.prt.1 so you end up with xxxxx.prt.prt.
echo. `%%~ni.prt`>%%~ni.txt
copy assytrail1.txt+%%~ni.txt+assytrail2.txt %%~ni.tmp >nul This code creates a combined file like xxxx.txt. with the extension .tmp. So you end up with a file called xxxxx.txt.tmp.
<?:namespace prefix = st1 ns = "urn:schemas-microsoft-com:eek:ffice:smarttags" /><st1:State w:st="on"><st1:place w:st="on">del</st1:place></st1:State> %%~ni.txt
)


echo Running ProE


for %%i in (*.tmp*) do call :process %%i


exit


:process


set partname=%1 This code collects the first file name in the directory and sets it to part name.
set trailname=%partname:.tmp=.txt% This code assigns a trialname called xxxxx.txt.tmp and then changes the extension from tmp to txt. So you end up with a file called xxxxx.txt.txt.
move /y %partname% %CD%\proeparts\%trailname%
echo. Processing %partname%
cd %CD%\proeparts
call C:\yourproefolder\proe2001.bat %trailname% -g:no_graphics pro_wait
<st1:place w:st="on"><st1:State w:st="on">del</st1:State></st1:place> %trailname%
cd..\
************************************************************ ******************


The batch file creates a trailfile for each part by combining assytrail1.txt, partname and assytrail2.txt.
proe2001.bat then uses the created trailfile to assemble each part.


For vrml files you will need to amend the batch file and change the 2 lines that contain .prt to .wrl
you will also need to change c:\yourprofolder\proe2001.bat to suit your system.


Open the assembly you created and delete the part added, then save the file and exit proe.


Run the batchfile runtrail.bat


You should now have an assembly that contains all you parts.
 
Just curious:


In archiving these files, is it required to archive the trail and batch files in order to bring this assembly up?


What would happen if a part needed to be replaced by another part that uses the same means of assembly?


Thanks,


WillyT
 
No, The trail and batch files are only used to create the assembly. Once the assembly has been created it can be opened as normal, providing the parts still exist.


Parts can be replaced in the assemblyusing the normal replace procedure.
 

Sponsor

Articles From 3DCAD World

Back
Top