EngProgrammer
Aerospace
- Jan 14, 2015
- 150
Dear Forum,
I am trying to get the centroids of the faces that make up a block.
I am using the following code to create the block. Now, I want to get the centroids of the faces.
Dim corner_pt(2) As Double
Dim block_feat_tag As NXOpen.Tag
Dim edge_lengths(2) As String
edge_lengths(0) = "iBarStockLength=" & Length.ToString()
edge_lengths(1) = "iBarStockHeight=" & Height.ToString()
edge_lengths(2) = "iBarStockThickness=" & Thickness.ToString()
Dim sign As FeatureSigns
sign = FeatureSigns.Nullsign
corner_pt(0) = 0
corner_pt(1) = 0
corner_pt(2) = 0
ufs.Modl.CreateBlock1(sign, corner_pt, edge_lengths, block_feat_tag)
If block_feat_tag <> NXOpen.Tag.Null Then
ufs.View.FitView(NXOpen.Tag.Null, 1.0)
'MsgBox("First Solid Body tag is: " & block_feat_tag.ToString)
End If
Dim featName As String = Nothing
theUFSession.Modl.AskFeatName(block_feat_tag, featName)
Dim bodyFeature1 As Features.BodyFeature = CType(workpart.Features.FindObject(featName), Features.BodyFeature)
bodyFeature1.SetName("Solid Copper Bar")
Dim nxBlock As NXObject
nxBlock = CType(bodyFeature1, NXObject)
nxBlock.SetName("Solid Copper Bar")
Return nxBlock
I am trying to get the centroids of the faces that make up a block.
I am using the following code to create the block. Now, I want to get the centroids of the faces.
Dim corner_pt(2) As Double
Dim block_feat_tag As NXOpen.Tag
Dim edge_lengths(2) As String
edge_lengths(0) = "iBarStockLength=" & Length.ToString()
edge_lengths(1) = "iBarStockHeight=" & Height.ToString()
edge_lengths(2) = "iBarStockThickness=" & Thickness.ToString()
Dim sign As FeatureSigns
sign = FeatureSigns.Nullsign
corner_pt(0) = 0
corner_pt(1) = 0
corner_pt(2) = 0
ufs.Modl.CreateBlock1(sign, corner_pt, edge_lengths, block_feat_tag)
If block_feat_tag <> NXOpen.Tag.Null Then
ufs.View.FitView(NXOpen.Tag.Null, 1.0)
'MsgBox("First Solid Body tag is: " & block_feat_tag.ToString)
End If
Dim featName As String = Nothing
theUFSession.Modl.AskFeatName(block_feat_tag, featName)
Dim bodyFeature1 As Features.BodyFeature = CType(workpart.Features.FindObject(featName), Features.BodyFeature)
bodyFeature1.SetName("Solid Copper Bar")
Dim nxBlock As NXObject
nxBlock = CType(bodyFeature1, NXObject)
nxBlock.SetName("Solid Copper Bar")
Return nxBlock