Isolating sub asm with dwg from main asm
Isolating sub asm with dwg from main asm
(OP)
Hello,
Using ugzip, we make a copy of a sub asm to isolate it from thousands of other component/sub asm files.
The original folder that contain the top asm also includes the drawing files for most of the components.
Since the drawing files are not included in the top asm, ugzip does not include them in the isolated sub asm.
Is there a way to copy/move all the drawings files that has a match with the sub asm model files?
The file format for the models are abc12345.f01.0010.prt and for the corresponding drawing is abc12345.d01.0010.prt. The only difference is the f & d in the middle of the file name.
What I have been trying is generating a text file that list the model file names in the sub asm folder and trying to use that list to copy over the drawing files. I can't figure out how to do it. I am thinking that the batch file or script should be looking at the first 8 characters of the file names in the list, ignore the rest of the characters and copy or move the files into the specified folder. I don't care if the script overwrites the existing models of the sub asm in the sub asm folder.
Really appreciate any help or hints!
TIA!
Roark
UGNX 8/8.5/9
Windows 7 64bit
Using ugzip, we make a copy of a sub asm to isolate it from thousands of other component/sub asm files.
The original folder that contain the top asm also includes the drawing files for most of the components.
Since the drawing files are not included in the top asm, ugzip does not include them in the isolated sub asm.
Is there a way to copy/move all the drawings files that has a match with the sub asm model files?
The file format for the models are abc12345.f01.0010.prt and for the corresponding drawing is abc12345.d01.0010.prt. The only difference is the f & d in the middle of the file name.
What I have been trying is generating a text file that list the model file names in the sub asm folder and trying to use that list to copy over the drawing files. I can't figure out how to do it. I am thinking that the batch file or script should be looking at the first 8 characters of the file names in the list, ignore the rest of the characters and copy or move the files into the specified folder. I don't care if the script overwrites the existing models of the sub asm in the sub asm folder.
Really appreciate any help or hints!
TIA!
Roark
UGNX 8/8.5/9
Windows 7 64bit
UGNX7.5.2.5 MP3 Rev D \ Windows 7 64bit
Productive Design Services
www.productivedesign.com





RE: Isolating sub asm with dwg from main asm
For your consideration...
This example is deigned to run from the directory where the isolated sub assembly parts have been (already) copied to.
This example requires that "source_dir" be edited on the third line.
As coded this will just display the copy command that would be executed.
To actually perform the copy operation remove the "ECHO" (bold) from the "if exist" line (third from bottom).
HTH,
Joe
CODE --> DOS_batch
RE: Isolating sub asm with dwg from main asm
I modified it a bit so the user is prompted for the source_dwg_dir. Could you tell me how to modify it so that it would ignore the 4 character revision at the end of the filename? Just in case if the model and the drawing does not have the same revision.
@echo off
setlocal ENABLEDELAYEDEXPANSION
set /p Source_DWG_Dir= Enter directory for drawing files:
set source_dir=%Source_DWG_Dir%
echo off set source_dir
for /f "usebackq tokens=*" %%i in (`dir /b *.f??.*.prt`) do (
set part=%%i
set part
set dwg=!part:f=d!
set dwg
if exist "!source_dir!\!dwg!" copy /y "!source_dir!\!dwg!"
)
pause
UGNX 8 / 8.5 / 9 - Windows 7 64bit
Productive Design Services
www.productivedesign.com
RE: Isolating sub asm with dwg from main asm
Apologies. It was clear in your original post and I missed that requirement.
This will copy all of the .d drawing files for the .f part files independent of the revisions of the drawing(s).
It ignores the 4 character .prt extension and the 4 characters of the revision.
HTH,
Joe
CODE --> DOS_batch
RE: Isolating sub asm with dwg from main asm
UGNX 8 / 8.5 / 9 - Windows 7 64bit
Productive Design Services
www.productivedesign.com
RE: Isolating sub asm with dwg from main asm
UGNX 8 / 8.5 / 9 - Windows 7 64bit
Productive Design Services
www.productivedesign.com
RE: Isolating sub asm with dwg from main asm
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: Isolating sub asm with dwg from main asm
Yes. To create the MB3 action this presumes:
- You are logged as a member of the administrator group on the computer.
- The Windows explorer MB3 action is to be launched from the directory where the NX part files have been copied to.
- MB3 is invoked while the mouse pointer is over the windows explorer background and no row(s) (files) are selected.
- The MB3 action is titled "Get NX Drawings" (edit below as desired).
- The script name and location in the example below is edited to use the actual script name and location.
CODE --> Dos_command_line
The use of the MB3 action does not require administrator rights.
I wondered if copying all of the drawings for the model part was the best solution when there was more than one drawing.
Here is an alternative that will only copy the highest numbered drawing for the given part revision.
HTH, Joe
CODE --> DOS_batch