Hi Guys, I'm new here and new to macro programming (I'm still at the 'cut and copy' stage:-) , could you help me with a small problem?
I'd like to have a simple macro that allows me to import a reference step model. I can get it to work if the model is always in the same location/folder, but I want the macro to simply open the windows browser, allowing the user to go find the model even if it's in a different place.
If you guys could give me a couple of pointers it would be massivley appreciated!
Cheers
Hi Tony
What verson of the software are you using?
I'm currently using v11.0.34
Here is a macro someone gave me that imports reference file for V11. I hope this helps.
version "4.0"
DECLARE i 1
DECLARE CAD
DECLARE CAD_Type
DECLARE Pro
DECLARE na
DECLARE nam
DECLARE name
DECLARE sw
# Input CAD files
INPUT FILE_PATH (CAD, "Browse for CAD file")
SET CAD_Type $CAD:e
# Troubleshoot PRT files
IF $CAD_Type == "prt"
INPUT QUESTION (Pro, "Are your *.prt Pro/ENGINEER files?" )
ENDIF
# Catia V4
IF $CAD_Type == "exp"
FILE IMPORT_REFERENCE NURBS CATIA_V4 ("Standard Entities", "$CAD")
ENDIF
IF $CAD_Type == "model"
FILE IMPORT_REFERENCE NURBS CATIA_V4 ("Standard Entities", "$CAD")
ENDIF
# Catia V5
IF $CAD_Type == "CATPart"
FILE IMPORT_REFERENCE NURBS CATIA_V5 ("Standard Entities", "$CAD")
ENDIF
# IGES
IF $CAD_Type == "igs"
FILE IMPORT_REFERENCE NURBS IGES ("$CAD")
ENDIF
# Pro/E & UG
IF $CAD_Type == "prt"
IF $Pro == 1
FILE IMPORT_REFERENCE NURBS PRO_E("Standard Entities", "$CAD")
ENDIF
IF $Pro == 0
INPUT QUESTION (sw, "Are your *.prt SolidWorks files? (Saying No implies that they are UG files)" )
If $SW == 1
FILE IMPORT_REFERENCE NURBS SOLIDWORKS ("Standard Entities", "$CAD")
Else
FILE IMPORT_REFERENCE NURBS UG ("Standard Entities", "$CAD")
ENDIF
ENDIF
ENDIF
# SAT
IF $CAD_Type == "sat"
FILE IMPORT_REFERENCE NURBS SAT ("$CAD")
ENDIF
# SolidWorks
IF $CAD_Type == "sldprt"
FILE IMPORT_REFERENCE NURBS SOLIDWORKS ("Standard Entities", "$CAD")
ENDIF
# Inventor
IF $CAD_Type == "ipt"
FILE IMPORT_REFERENCE NURBS INVENTOR ("Standard Entities", "$CAD")
ENDIF
# Step
IF $CAD_Type == "stp"
FILE IMPORT_REFERENCE NURBS STEP ("$CAD")
ENDIF
# VDA
IF $CAD_Type == "vda"
FILE IMPORT_REFERENCE NURBS VDA_FS ("$CAD")
ENDIF
# Save IMInspect Project
SET na $CAD:t
SET nam $na:r
SET name "${nam}_CAD"
FILE SAVE_PROJECT_AS ( , "$name")
Jeff that's just the ticket, thanks, it's massively apreciated! Have a good weekend!