Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.
Seriously, I'll put at least five threads on (somewhere between a FAQ and a WTFDYDITW) on the subject as I've been working on Office/Trail File automation and integration.
Trouble is there'll be a lot of cross overs between VBA questions etc.
Let's try kicking it off with a simple enough thing that everyone might want, but no one is that bothered to go out and do a proper job with:
Has anyone ever tried to automated the removal of unnecessary lines from a Trail File (all the "~ Wheel" commands "~ Open `main_dlg_cur` `ActionMenu`" commands etc.) to make it a more ruley file?
I've tried, using Excel and it sure removes the crap, but also one or two other, more useful things. So it's not 100%.
Has anyone ever tried to automated the removal of unnecessary lines from a Trail File (all the "~ Wheel" commands "~ Open `main_dlg_cur` `ActionMenu`" commands etc.) to make it a more ruley file?
I've tried, using Excel and it sure removes the crap, but also one or two other, more useful things. So it's not 100%.
The VBA loads the trail file as a worksheet and then barges right through the whole lot, checking the first few characters of the line, and if they match certain criteria takes the whole line out.
It takes out all lines starting "!", which are usually comments, except (I believe) the first which is needed for ProE. So it puts that back in.
Here is the Code:
*DOESN'T CURRENTLY DO WHAT IT IS SUPPOSED TO* Don't use it on your useful trail files if you haven't backed them up!!!!
-AS
'==============================================
Sub Hunter()
Dim VFF As Long, trailwpath As String, trailoutput As String, trailbody As String, trailbodyO As String, vIStep As String
Dim iLastRow As Long
If Left$(.Cells(i, "A").Value, 7) = "~ Wheel" Then
.Rows(i).Resize(2).Delete
' ElseIf Left$(.Cells(i, "A").Value, 6) = "~ LBut" Then
'  ; .Rows(i).Resize(2).Delete
ElseIf Left$(.Cells(i, "A").Value, 1) = "!" Then
.Rows(i).Delete
ElseIf Left$(.Cells(i, "A").Value, 1) = "<" Then
.Rows(i).Delete
End If
Next i
Looking back at the code, you can tell it was something I just mod'ed as I could have easily eliminated those insert lines by just stopping the hunter routine at line 3 instead of line 1 in the "For i= ...." line.
A more on topic and relevent conversation here might be the commands that are considered "Useless" in a trail file. Most trail files I use are in the no graphics mode, so I could live without all the mouse movements and button up and menu open menu close commands, which is what I was trying to do here.
I did compile one for a local company once, I'll give a dig through the records later, there's suprisingly large amount you can live without in Trail files.
Mouse button and wheel commands are obvious, not so obvious are the menu open and close commands, the important ones are after the menu close normally.
the same can be said for mapkeys... a ref. to the pre wf list would be great too... what still works.., but no telling how long it will last.
I saw a demo of ProE VBA .. it could of gone into more detail but I have the feeling it's going to be more like ProeVBA than VBA , I'll bet the editor is going to be a toad....but better than nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.