cancel
Showing results for 
Search instead for 
Did you mean: 

How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Pioneer
Pioneer

 I use the following to differentiate between featureGeometry and orientGeometry:

 

 if TypeOf ncGroup1 is CAM.featureGeometry then

elseif TypeOf ncGroup1 is CAM.orientGeometry then

endif

 

Then, how to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY" as both are featureGeometry?

 

Thanks

 

LIM

NX 10.0.1.4, WINDOWS 7

 

 

 

 

 

 

NX 10.0.3.5, WINDOWS 7
5 REPLIES

Re: How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Esteemed Contributor
Esteemed Contributor

I always use theNCGroup.GetType().ToString(), since that should return "NXOpen.CAM.HoleBossGeometry", etc.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Pioneer
Pioneer

hi stefan,

Thanks for your reply, but it return the same type for either one.

I have tried this:

 

Dim ncGroup1 as CAM.NCGroup = CTYPE(workpart.CAMSetup.CAMGroupCollection.Findobject("WORKPIECE"),CAM.NCGroup)

lw.Writeline("Geometry = " + ncGroup1.name + " , type = " + ncgroup1.gettype().tostring())

 

the output:

   geometry = WORKPIECE , type = NXOpen.CAM.FeatureGeometry

 

when I change the "WORKPIECE" to "HOLE_BOSS_GEOM" it gives:

   geometry = HOLE_BOSS_GEOM , type = NXOpen.CAM.FeatureGeometry

 

It still show FeatureGeometry for both "WORKPIECE" and  "HOLE_BOSS_GEOM"

any clue?

 

THANKS

 

LIM

NX 10.0.1.4, WINDOWS 7

 

 

NX 10.0.3.5, WINDOWS 7

Re: How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Are you sure the WORKPIECE is a mill_geom group, and not a renamed hole boss group?

Go to create geometry, and create new WORKPIECE and MILL_GEOM groups (they shoul dbe identical), and then run your program. 

Mark Rief
Retired Siemens
Highlighted

Re: How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Pioneer
Pioneer

Hi Mr.Mark,

I created the geometry using the hole_making template's Geometry subtype "WORKPIECE" and "HOLE_BOSS_GEOM" with the default name "WORKPIECE" and "HOLE_BOSS_GEOM" respectively.

Please refer to the picture I have attached.

Thanks

LIM

NX10.0.1.4, WINDOWS 7

Untitled.jpg

NX 10.0.3.5, WINDOWS 7

Re: How to differentiate between "WORKPIECE" & "HOLE OR BOSS GEOMETRY"

Pioneer
Pioneer

here is my codes:

' NX 10.0.1.4
' Journal created by sclim on Tue May 24 09:06:38 2016 Malay Peninsula Standard Time
'
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow

        lw.open()
' ----------------------------------------------
'   Menu: Insert->Geometry...
' ----------------------------------------------

Dim nCGroup1 As NXOpen.CAM.NCGroup = CType(workPart.CAMSetup.CAMGroupCollection.FindObject("GEOMETRY"), NXOpen.CAM.NCGroup)

Dim nCGroup2 As NXOpen.CAM.NCGroup
nCGroup2 = workPart.CAMSetup.CAMGroupCollection.CreateGeometry(nCGroup1, "hole_making", "WORKPIECE", NXOpen.CAM.NCGroupCollection.UseDefaultName.True, "WORKPIECE")

        lw.writeline(" geometry name = " + nCGroup2.name + " type = " + nCGroup2.gettype().name)

Dim featureGeometry1 As NXOpen.CAM.FeatureGeometry = CType(nCGroup2, NXOpen.CAM.FeatureGeometry)

Dim millGeomBuilder1 As NXOpen.CAM.MillGeomBuilder
millGeomBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillGeomBuilder(featureGeometry1)


' ----------------------------------------------
'   Dialog Begin Workpiece
' ----------------------------------------------



Dim nXObject1 As NXOpen.NXObject
nXObject1 = millGeomBuilder1.Commit()



millGeomBuilder1.Destroy()


' ----------------------------------------------
'   Dialog Begin Create Geometry
' ----------------------------------------------

Dim featureGeometry2 As NXOpen.CAM.FeatureGeometry = CType(nXObject1, NXOpen.CAM.FeatureGeometry)

Dim nCGroup3 As NXOpen.CAM.NCGroup
nCGroup3 = workPart.CAMSetup.CAMGroupCollection.CreateGeometry(featureGeometry2, "hole_making", "HOLE_BOSS_GEOM", NXOpen.CAM.NCGroupCollection.UseDefaultName.True, "HOLE_BOSS_GEOM")

        lw.writeline(" geometry name = " + nCGroup3.name + " type = " + nCGroup3.gettype().name)

Dim featureGeometry3 As NXOpen.CAM.FeatureGeometry = CType(nCGroup3, NXOpen.CAM.FeatureGeometry)

Dim holeBossGeometry1 As NXOpen.CAM.HoleBossGeometry
holeBossGeometry1 = workPart.CAMSetup.CAMGroupCollection.CreateHoleBossGeometryBuilder(featureGeometry3)

Dim geometrySetList1 As NXOpen.CAM.GeometrySetList
geometrySetList1 = holeBossGeometry1.FeatureGeometry.GeometryList

Dim geometrySetList2 As NXOpen.CAM.GeometrySetList
geometrySetList2 = holeBossGeometry1.FeatureGeometry.GeometryList


Dim nullNXOpen_CAM_CAMFeature As NXOpen.CAM.CAMFeature = Nothing

Dim featureSet1 As NXOpen.CAM.FBM.FeatureSet
featureSet1 = holeBossGeometry1.FeatureGeometry.AddFeatureSet(nullNXOpen_CAM_CAMFeature, "NXHOLE")

holeBossGeometry1.FeatureGeometry.SetDefaultAttribute("IS_THROUGH", 1)

geometrySetList2.Append(featureSet1)

featureSet1.AngleToleranceEdges = 0.0

featureSet1.Intol = 0.0

featureSet1.Outtol = 0.0

' ----------------------------------------------
'   Dialog Begin Hole or Boss Geometry
' ----------------------------------------------



Dim nXObject2 As NXOpen.NXObject
nXObject2 = holeBossGeometry1.Commit()



holeBossGeometry1.Destroy()

        lw.close()
' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module
NX 10.0.3.5, WINDOWS 7