- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to add a component using a transformation matrix.
newComponent = root.occurrences.addNewComponent(partMatrix)
When I try to add a new component using the partmatrix I get the error:
RuntimeError: 3 : invalid argument transform
I have the part Matrix in a dictionary called constructionData with the key "PartMatrix". I tried to create a new matrix and then set it with the values of the partMatrix but this also errors.
partMatrix:adsk.core.Matrix3D = constructionData["PartMatrix"]
mat= adsk.core.Matrix3D.create()
mat.setWithCoordinateSystem(partMatrix.getAsCoordinateSystem()[0],
partMatrix.getAsCoordinateSystem()[1],
partMatrix.getAsCoordinateSystem()[2],
partMatrix.getAsCoordinateSystem()[3])
newComponent = root.occurrences.addNewComponent(mat)
But when I do this,
partMatrix:adsk.core.Matrix3D = constructionData["PartMatrix"]
mat= adsk.core.Matrix3D.create()
transformMatrix.setToRotateTo(adsk.core.Vector3D.create(1,0,0),partMatrix.getAsCoordinateSystem()[1],adsk.core.Vector3D.create(1,0,0))
transformMatrix.setToRotateTo(adsk.core.Vector3D.create(0,1,0),partMatrix.getAsCoordinateSystem()[2],adsk.core.Vector3D.create(0,1,0))
transformMatrix.setToRotateTo(adsk.core.Vector3D.create(0,0,1),partMatrix.getAsCoordinateSystem()[3],adsk.core.Vector3D.create(0,0,1))
newComponent = root.occurrences.addNewComponent(mat)
I am able to rotate the matrix. However because I am doing it in steps, the rotation is wrong.
I am not sure why I am getting an error.
here is the matrix data as an array:
(-0.04609723612371068, 0.08869538091126858, 0.0028591374116374167, 0.0, 0.08869538091126858, 0.046153189469425746, -0.0017357773488455935, 0.0, -0.002859137411637416, 0.0017357773488455943, -0.09994404367405274, 0.0, 1.9448515944543634, 0.9751591343287863, 1.9185717820420838, 1.0)
Solved! Go to Solution.