Hi,
I am trying to insert a block to the drawing sheet. When i insertthe block, it always go to the bottom left corner of the sheet.This happens even if the defined math point is different. Below isthe code i used. I am facing this problem in Swx 2008. Please letme know if you have any solution.
Sub main()
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim SelMgr As SelectionMgr
Dim swSketchMgr As SldWorks.SketchManager
Dim nPt(3) As Double
Dim vpt As Variant
Dim swMathPoint2 As SldWorks.MathPoint
Dim swMathUtil As SldWorks.MathUtility
Dim swSketchBlockDef2 As SldWorks.SketchBlockDefinition
Dim swBlockInst As SldWorks.SketchBlockInstance
Dim swDraw As SldWorks.DrawingDoc
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swSketchMgr = Part.SketchManager
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Set swDraw = Part
swDraw.ActivateSheet ("Sheet1")
Set swSheet = swDraw.GetCurrentSheet
nPt(0) = 1.2 * 0.0254
nPt(1) = 1.2 * 0.0254
nPt(2) = 0#
vpt = nPt
Set swMathUtil = swApp.GetMathUtility
Set swMathPoint2 = swMathUtil.CreatePoint(vpt)
Set swSketchBlockDef2 =swSketchMgr.MakeSketchBlockFromFile(swMathPoint2,"C:\SSGWorks\TNB\Templates\Blocks\POLE_ORIENT_12SIDED_FLAT.SLDBLK", False, 1, 0)
Part.GraphicsRedraw2
End Sub
SolidworksApi macros
I am trying to insert a block to the drawing sheet. When i insertthe block, it always go to the bottom left corner of the sheet.This happens even if the defined math point is different. Below isthe code i used. I am facing this problem in Swx 2008. Please letme know if you have any solution.
Sub main()
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim SelMgr As SelectionMgr
Dim swSketchMgr As SldWorks.SketchManager
Dim nPt(3) As Double
Dim vpt As Variant
Dim swMathPoint2 As SldWorks.MathPoint
Dim swMathUtil As SldWorks.MathUtility
Dim swSketchBlockDef2 As SldWorks.SketchBlockDefinition
Dim swBlockInst As SldWorks.SketchBlockInstance
Dim swDraw As SldWorks.DrawingDoc
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swSketchMgr = Part.SketchManager
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
Set swDraw = Part
swDraw.ActivateSheet ("Sheet1")
Set swSheet = swDraw.GetCurrentSheet
nPt(0) = 1.2 * 0.0254
nPt(1) = 1.2 * 0.0254
nPt(2) = 0#
vpt = nPt
Set swMathUtil = swApp.GetMathUtility
Set swMathPoint2 = swMathUtil.CreatePoint(vpt)
Set swSketchBlockDef2 =swSketchMgr.MakeSketchBlockFromFile(swMathPoint2,"C:\SSGWorks\TNB\Templates\Blocks\POLE_ORIENT_12SIDED_FLAT.SLDBLK", False, 1, 0)
Part.GraphicsRedraw2
End Sub
SolidworksApi macros