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.

Relations and parameters and trail files.

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.





Who can start forums?
 
andysuth,


I think Turk is the guy, but if you starthere on this thread and there is lots of action .. it may get moved to a new forum,


I like to seethe forum
 
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%.





Anyone had any success with this?





-Andy



Edited by: andysuth
 
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%.


---------------------------------------


Are you doing this with VBA or on the sheet ?
 
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

trailwpath = "C:\ProE\trailfile.txt"

Workbooks.OpenText Filename:=trailwpath, _
Origin:=xlMSDOS, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True
With ActiveWorkbook.Worksheets(1)

iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For i = iLastRow To 1 Step -1

If Left$(.Cells(i, "A").Value, 7) = "~ Wheel" Then
.Rows(i).Resize(2).Delete
' ElseIf Left$(.Cells(i, "A").Value, 6) = "~ LBut" Then
'&nbsp ; .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

End With

ActiveCell.Range("a1").Select
ActiveCell.Rows.Insert
ActiveCell.Value = "!trail file version No. 1350"
ActiveWorkbook.Save
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True



End Sub
 
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.





-Andy.
 
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.





-AS
 
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
 

Sponsor

Back
Top