AnsweredAssumed Answered

problem with refplane.transform

Question asked by Yubo Hu on Jul 18, 2016
Latest reply on Jul 19, 2016 by Yubo Hu


Here i made a VBA code but always can not make it run, I tried to move the refplane by using transform property, but problems comes when I tried to assign doubler numbers to the transform matrix.



1. the code in red color is where error comes.



--------------------------START OF CODES------------------------------

Option Explicit



Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swPart As SldWorks.PartDoc

Dim swFeat As SldWorks.Feature

Dim swRefPlane As SldWorks.RefPlane

Dim swExten As SldWorks.ModelDocExtension

Dim swSelMgr As SldWorks.SelectionMgr

Dim swUtility As SldWorks.MathUtility

Dim swTrans As SldWorks.MathTransform

Dim trans() As Variant

Dim boolstatus As Boolean


Sub main()

Dim i As Integer

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swPart = swModel

Set swSelMgr = swModel.SelectionManager

Set swExten = swModel.Extension


boolstatus = swExten.SelectByID2("Plane2", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

Set swFeat = swSelMgr.GetSelectedObject6(1, -1)

Set swRefPlane = swFeat.GetSpecificFeature2()

MsgBox swRefPlane.Name & swRefPlane.GetTypeName

trans() = Array(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0, 1, 0, 0, 0)

For i = 0 To 15

  swTrans.ArrayData(i) = CDbl(trans(i))

Next i

Set swTrans = swRefPlane.transform

End Sub

---------------------------END OF CODE------------------------------

2. the error popup is as following


could anyone help me with this issue?