TBC Macros and Extensions

 View Only
Expand all | Collapse all

how to transform/move around IFCMesh objects

  • 1.  how to transform/move around IFCMesh objects

    Posted 03-15-2023 14:37

    The following code works for string lines and CadPoints but it won't move an IFCMesh object. The new objects are created but stay at the originals position.

    dp = self.currentProject.CreateDuplicator()
    
    # create a copy of the selected object
    o_new = wv.Add(clr.GetClrType(o_org.GetType()))
    o_new.CopyBody(self.currentProject.Concordance, self.currentProject.TransactionManager, o_org, dp)                        
    
    # this is the direction of the alignment at the paste point
    linevec = perpVector3D.Value
    linevec.Rotate90(Side.Left)
    rotation = Vector3D(ps1, ps2).Azimuth - linevec.Azimuth
    #BuildTransformMatrix(Trimble.Vce.Geometry.Point3D fromPnt, Trimble.Vce.Geometry.Point3D toPnt, double rotate, double scaleX, double scaleY, double scaleZ)
    targetmatrix = Matrix4D.BuildTransformMatrix(ps1, p1, rotation, 1.0, 1.0, 1.0)
    
    o_new.Transform(TransformData(targetmatrix, Matrix4D(Vector3D.Zero)))
    

    As a test I used the same .Transform on the original, I thought that there may be a "connection" left between old and new, but the old one also stays where it is. .Transform doesn't seem to have any effect on the IFCMesh.



    ------------------------------
    Ronny Schneider
    ------------------------------


  • 2.  RE: how to transform/move around IFCMesh objects

    Posted 03-15-2023 17:23

    I found the issue, it was the 

    Matrix4D(Vector3D.Zero)

    You can save the result of the transformation into a variable,

    tt = o_new.Transform(TransformData(targetmatrix, Matrix4D(Vector3D.Zero)))

    and that one showed me "UnsupportedUCS".

    With

    tt = o_new.Transform(TransformData(targetmatrix, None))

    it works.



    ------------------------------
    Ronny Schneider
    ------------------------------