RFShell.SetMeasuringCoordinate



Your Ad Here

Description

Defines the local coordinate system of the shell as specified.

Syntax

Function RFShell.SetMeasuringCoordinate(orgX As Double, orgY As Double, orgZ As Double, uX As Double, uY As Double, uZ As Double, vX As Double, vY As Double, vZ As Double) As RFErrorCode

The SetMeasuringCoordinate syntax has these parts:

Part Description
orgX [INDouble Required. X coordinate of the origin point.
orgY [INDouble Required. Y coordinate of the origin point.
orgZ [INDouble Required. Z coordinate of the origin point.
uX [INDouble Required. X axis value of the U vector.
uY [INDouble Required. Y axis value of the U vector.
uZ [INDouble Required. Z axis value of the U vector.
vX [INDouble Required. X axis value of the V vector.
vY [INDouble Required. Y axis value of the V vector.
vZ [INDouble Required. Z axis value of the V vector.

Remarks

Sample

Dim rfErr As RFErrorCode
Dim mdObj As RapidForm.RFModel
Dim shObj As RapidForm.RFShell
Dim vtObj As RapidForm.RFVertex

    Set mdObj = RapidForm.Model
    Set shObj = RapidForm.Shell
    Set vtObj = RapidForm.Vertex
    
    Dim shID As RFEntityID
    
    ' Add a blank sell.
    shID = mdObj.AddShell(RF_MEASURED_SHELL, "Simple shell")
    
    ' Register the shell in the GUI database.
    rfErr = RapidForm.UserInterface.AddShellToProjectTree(shID)
    
    rfErr = shObj.SetID(shID)
            
    ' Define the local coordinate of the shell as follows,
    ' The origin = {0,0,10}
    ' U axis = {0,1,0}
    ' V axis = {1,0,0}
    rfErr = shObj.SetMeasuringCoordinate(0, 0, 10, 0, 1, 0, 1, 0, 0)
    
    ' Retreives the local to global transformation matrix.
    Dim l2gMat As RFTMatrix
    rfErr = shObj.GetLocalToGlobalMatrix(l2gMat)
    
    ' Retreives the global to local transformation matrix.
    Dim g2lMat As RFTMatrix
    rfErr = shObj.GetLocalToGlobalMatrix(g2lMat)
    
    ' Add {5,10,-5} point of the local coordinate system as a new vertex in the shell.
    ' All vertex coordinates passed in the AddVertex method are interpreted in reference to the global coordinate.
    Dim orgPt As RFPoint3
    Dim vtID As RFEntityID
    
    orgPt.x = 5
    orgPt.y = 10
    orgPt.z = -5
    
    ' Get the global coordinates of orgPt
    Dim globalPt As RFPoint3
    globalPt.x = l2gMat.m(0, 0) * orgPt.x + l2gMat.m(1, 0) * orgPt.y + l2gMat.m(2, 0) * orgPt.z + l2gMat.m(3, 0)
    globalPt.y = l2gMat.m(0, 1) * orgPt.x + l2gMat.m(1, 1) * orgPt.y + l2gMat.m(2, 1) * orgPt.z + l2gMat.m(3, 1)
    globalPt.z = l2gMat.m(0, 2) * orgPt.x + l2gMat.m(1, 2) * orgPt.y + l2gMat.m(2, 2) * orgPt.z + l2gMat.m(3, 2)
    
    rfErr = shObj.AddVertex(globalPt.x, globalPt.y, globalPt.z, vtID)

    rfErr = vtObj.SetID(vtID)
    
    ' Retrieves the first vertex coordinates in the local coordinate system.
    Dim localPt As RFPoint3
    rfErr = shObj.SetCoordinateMode(RF_LOCAL_COORDINATE_MODE)
    rfErr = vtObj.GetPoint(localPt)
    
    ' Retrieves the first vertex coordinates in the global coordinate system.
    rfErr = shObj.SetCoordinateMode(RF_GLOBAL_COORDINATE_MODE)
    rfErr = vtObj.GetPoint(globalPt)
    
    ' Update the GUI database and redraw the scene.
    rfErr = RapidForm.Document.RegenShell(shID)
    RapidForm.Document.RedrawScene

Return to Rapidform Index


Your Ad Here