Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.


Forum Highlight: CATIA V6

 

Get Answers to Your V6 Questions
Dassault Systèmes answers user questions about CATIA V6.  Discuss these answers and propose new questions with end users from around the world in the CATIA V6 Forum.

COE DISCUSSION FORUM
Subject: Sample Script to Demonstrate Walking through files

You are not authorized to post a reply.   
Author Messages
HALE


27 Apr 2008 01:00 PM

Guys,

 

I've been meening to put this up for a while.  I put it together for a presentation that didn't fly.

Most of us never start writing a script or program from a blank screen.  We copy somethings from our toolbox that is close and modify.  Well in the beginning my toolbox was empty.  Heck I didn't even have a toolbox. 

I find that many of the one-off requrests I get involve

  1. Looking at each file in a folder and doing something in SmarTeam for each (walking the folder)

   2. Doing a query in SmarTeam and looking at each row that results and doing something with each row  (walking SmarTeam)

   3. Reading each line of a text file and doing something in SmarTeam for the file decribed by the row (walking a text file)

This script demonstrates each of these "walking" situations.

It also contains a little function to take the results of DIR *.??? > dir.txt and strip the left side off so that the file name is in the left column.  This allows the file to sorted using the DOS sort.  Archaic but Quick and Dirty.

Option 1 - Create Readme and open in NotePad, Create/Edit INI file
Option 2 - Report on which files in a Vault Folder are NOT in SmarTeam
Option 3 - Report on which files in SmarTeam are NOT in the Vault Folder
Option 4 - See if Drawings in the Vault have PDF files and Parts/Products have CGR files
Option 5 - Copy a text file created with DIR > wo the left 40 char
Option 6 - Read a Text file and report how many are in SmarTeam
              Note:  This sample adds the word Special_X to the comment of    CATDrawings found , this lets us go into Smarteam and query on "*Special_X*" in the comment field.
Option 7 - Test a routine that converts revisions to numbers - larger number = larger revision

Please note that this code is for educational use only.  It has not been heavily tested.  Use it to jump start your own programming and use it at your own risk.  Sorry about the legaleze disclaimer and all that, but today you just gotta do it.

Hope this helps someone,

Regards,

Hale

 


Attachment: 14270578067.zip


Badencorp - CATIA/SmarTeam - Installation, Training and Support!
An hour of hard work can often save you 60 seconds on Google.
You are not authorized to post a reply.
Forums > COE Forums > SmarTeam > Sample Script to Demonstrate Walking through files



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)