New Drawing Macro Help



I've got a macro question, I'm trying to make a macro that creates a
new drawing file from an assembly file, I am then wanting it to
generate various views placed in the same place. The last couple of
lines are the problem, this macro places views of a certain file but if
I open up a different assembly and make a drawing it places the views
from the first assembly. Any help would be greatly appreciated. I
know very little about Visual Basic, I'm currently taking a class in it
but I haven't learned much yet. I'm looking for the command to use
that selects the currently opened file name and puts it as a variable
to use in the drawing view creation. Also is there any way to make a
macro to do the selected dimension. For example a macro to change a
dimension that is selected to mm from inches?

'
******************************************************************************
' D:\DOCUME~1\LUCASL~1\LOCALS~1\Temp\swx4356\Macro1.swb - macro
recorded on 05/28/06 by *********************
'
******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object

Sub main()

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.NewDocument("Drawing Template File Path", 12, 0.2794,
0.4318)
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.ViewZoomtofit2
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW",
0.1173527476636, 0.1787637757009, 0, False, 0, Nothing, 0)
Part.EditDelete
Dim DrawView As Object
Set DrawView = Part.CreateDrawViewFromModelView2("Assembly File Path",
"*Isometric", 0.1297821308411, 0.1627831401869, 0)
boolstatus = Part.ActivateView("Drawing View4")
Set DrawView = Part.CreateDrawViewFromModelView2("Assebly File Path",
"*Front", 0.294915364486, 0.1610075140187, 0)
Part.ClearSelection2 True
End Sub

Lucas Laverman
Senior, Mechanical Engineering

.



Relevant Pages

  • Re: Kill a Macro?
    ... that the execution goes back to the calling routine after the called routine ... first macro in File 1 open File 2? ... Dim pwkbDestination As Workbook ... 'Update button in user file Account Summary Sheet runs this macro ...
    (microsoft.public.excel.programming)
  • Re: Add rows/form fields on doc w/ multiple tables & calculate
    ... ' Macro written 12/01/2003 by Charles Kyle Kenyon ... Dim oTemplate As Template ... .CorrectInitialCaps = True ... Sub InsertRowAboveMe() ...
    (microsoft.public.word.vba.general)
  • Re: Get individual step Details of Macro?
    ... For an upcoming Add-In I will be releasing, I needed to gather a list of all macro ... Export out each macro using the SaveAsText option to the temp file. ... Dim intFileIn As Integer ... Dim strMacroNames As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Moving to next field with F11 in protected document
    ... macro is invoked with a keyboard hotkey and looks at the characters to ... a file with the name of the selection and inserts one space and then ... Dim rgeField As Range ... Dim lngStart As Long ...
    (microsoft.public.word.vba.beginners)
  • RE: date format in CSV
    ... Dim FName As String ... Sub WriteCSV(book As Workbook, FName As String) ... I'll paste the whole MACRO here for you. ... Myvalue = InputBox ...
    (microsoft.public.excel.programming)