Hello
This is a example code which is not working. Progecad 2014.
How should I fill the Matrix? Couldn't find a solution.
Sub TransformBy()
' This example creates a line and rotates it 90 degrees
' using a transformation matrix.
Dim myDoc As IntelliCAD.Document
' Create a line
Dim lineObj As IntelliCAD.Line
Dim startPt As IntelliCAD.Point
Dim endPt As IntelliCAD.Point
Set myDoc = Application.ActiveDocument
Set startPt = Library.CreatePoint(2, 1, 0)
'startPt(0) = 2: startPt(1) = 1: startPt(2) = 0
'endPt(0) = 5: endPt(1) = 1: endPt(2) = 0
Set endPt = Library.CreatePoint(5, 1, 0)
Set lineObj = myDoc.ModelSpace.AddLine(startPt, endPt)
lineObj.Update
' Initialize the transMat variable with a transformation matrix
' that will rotate an object by 90 degrees about the point(0,0,0)
' (More examples of transformation matrices are listed below)
'Dim transArray(0 To 3, 0 To 3) As Double
Dim transMat(0 To 3, 0 To 3) As Matrix
transMat(0, 0) = 0: transMat(0, 1) = -1: transMat(0, 2) = 0: transMat(0, 3) = 0
transMat(1, 0) = 1: transMat(1, 1) = 0: transMat(1, 2) = 0: transMat(1, 3) = 0
transMat(2, 0) = 0: transMat(2, 1) = 0: transMat(2, 2) = 1: transMat(2, 3) = 0
transMat(3, 0) = 0: transMat(3, 1) = 0: transMat(3, 2) = 0: transMat(3, 3) = 1
'transArray(0, 0) = 0: transArray(0, 1) = -1: transArray(0, 2) = 0: transArray(0, 3) = 0
'transArray(1, 0) = 1: transArray(1, 1) = 0: transArray(1, 2) = 0: transArray(1, 3) = 0
'transArray(2, 0) = 0: transArray(2, 1) = 0: transArray(2, 2) = 1: transArray(2, 3) = 0
'transArray(3, 0) = 0: transArray(3, 1) = 0: transArray(3, 2) = 0: transArray(3, 3) = 1
' Transform the line using the defined transformation matrix
MsgBox "Transform the line.", , "TransformBy Example"
lineObj.TransformBy (transMat) ' creates Type mismatch error
'ZoomAll
MsgBox "The line is transformed.", , "TransformBy Example"
End Sub
This is a example code which is not working. Progecad 2014.
How should I fill the Matrix? Couldn't find a solution.
Sub TransformBy()
' This example creates a line and rotates it 90 degrees
' using a transformation matrix.
Dim myDoc As IntelliCAD.Document
' Create a line
Dim lineObj As IntelliCAD.Line
Dim startPt As IntelliCAD.Point
Dim endPt As IntelliCAD.Point
Set myDoc = Application.ActiveDocument
Set startPt = Library.CreatePoint(2, 1, 0)
'startPt(0) = 2: startPt(1) = 1: startPt(2) = 0
'endPt(0) = 5: endPt(1) = 1: endPt(2) = 0
Set endPt = Library.CreatePoint(5, 1, 0)
Set lineObj = myDoc.ModelSpace.AddLine(startPt, endPt)
lineObj.Update
' Initialize the transMat variable with a transformation matrix
' that will rotate an object by 90 degrees about the point(0,0,0)
' (More examples of transformation matrices are listed below)
'Dim transArray(0 To 3, 0 To 3) As Double
Dim transMat(0 To 3, 0 To 3) As Matrix
transMat(0, 0) = 0: transMat(0, 1) = -1: transMat(0, 2) = 0: transMat(0, 3) = 0
transMat(1, 0) = 1: transMat(1, 1) = 0: transMat(1, 2) = 0: transMat(1, 3) = 0
transMat(2, 0) = 0: transMat(2, 1) = 0: transMat(2, 2) = 1: transMat(2, 3) = 0
transMat(3, 0) = 0: transMat(3, 1) = 0: transMat(3, 2) = 0: transMat(3, 3) = 1
'transArray(0, 0) = 0: transArray(0, 1) = -1: transArray(0, 2) = 0: transArray(0, 3) = 0
'transArray(1, 0) = 1: transArray(1, 1) = 0: transArray(1, 2) = 0: transArray(1, 3) = 0
'transArray(2, 0) = 0: transArray(2, 1) = 0: transArray(2, 2) = 1: transArray(2, 3) = 0
'transArray(3, 0) = 0: transArray(3, 1) = 0: transArray(3, 2) = 0: transArray(3, 3) = 1
' Transform the line using the defined transformation matrix
MsgBox "Transform the line.", , "TransformBy Example"
lineObj.TransformBy (transMat) ' creates Type mismatch error
'ZoomAll
MsgBox "The line is transformed.", , "TransformBy Example"
End Sub
Last edited by jouni on Tue Nov 15, 2016 2:23 pm, edited 2 times in total.