How do I use pointer?

I have the following macro to insert two blocks in a drawing. I create a new view to insert there blocks into but I cant figure out how to activate the new view so the blocks gets inserted correctly? Any ideas on how to use the new view?

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim instance As IDrawingDoc

Sub main()

Dim LowerLeftX As Double
Dim LowerLeftY As Double
Dim SketchSize As Double
Dim Scale1 As Double
Dim value As View
Dim yes As Boolean


Set swApp = Application.SldWorks
Set instance = swApp.ActiveDoc

Set value = instance.CreateViewport3(0, 0, 0, 0)
Set Part = swApp.ActiveDoc
Dim myBlockDefinition As Object

Set myBlockDefinition = Part.SketchManager.MakeSketchBlockFromFile(Nothing, "U:\\Fredrik_std\\ISO.sldblk", False, 0.25, 0)
Set myBlockDefinition = Part.SketchManager.MakeSketchBlockFromFile(Nothing, "U:\\Fredrik_std\\Note Imperial Units.SLDBLK", False, 0.1, 0)
End Sub

SolidworksApi macros
Answers 3
SF
SF 2011-01-13 Best Answer

Hi Fredrik,

Have you tried recording a macro of what you are trying to do and then analyzing the generated code to see what it is doing?  This might help.

Also, try going into the API Help file (can be found in SW under help->API Help) and searching for "Create Block Definition and Insert Block Instance Example".  This example should help you a lot.

If you still have questions, feel free to keep on posting and we will see what we can do.

Good Luck,

Rob

SF
SF 2011-01-14

it is not possible to record a macro to do this and i cant find any further information uin the help area.

But I have the pointer to the new view (value). My question is just how to use this.

Dim value As View

SF
SF 2011-01-14

When you have this "value" object which is defined as sldworks.view you can get the name of the view with methods value.Name or value.GetName2. Look for the API-Help more closely, you will find out how to use these, getting started section of API-help is good point to start.