cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Creo 2.0 Family table verify Using VB.NET

bsomasundaram
1-Newbie

Creo 2.0 Family table verify Using VB.NET

Hi,

I want to verify the family table in the existing part file using VB.NET. Because of some values are updated even if i use regenerate process table not verified.

Please help me if you anyone know the process / idea.

Balaji.S

46 REPLIES 46

Thank you ketan...

Hi ketan

I have one doubt in family table process.

Just i want to add one more cell,value and suppress in family table using coding.

Which is easy method for that process.

Thnaks

Balaji,S

plz try method append of class IpfcFamilyTableColumns

Hi Ketan,

Thanks for your reply.

I will check with that method and let you know the status.

Thnks,

Balaji.S

Hi Ketan,

Now I am suppressing the particular hole feature in the part file without adding cell in family table.

I tried with below coding and it show error ( Object reference not set to an instance of an object)

'------------------------------

Dim f1 As IpfcFeature

Dim sup As IpfcSuppressOperation

Dim op As New CpfcFeatureOperations

Dim solid As IpfcSolid

Dim LmodDoc As IpfcModel = retrieveModelFromStdDir(session, EpfcModelType.EpfcMDL_PART, parttwofile)

If Not LmodDoc Is Nothing Then

                LmodDoc.Display()

                session.CurrentWindow.Activate()

                new_parameter = LmodDoc

                model = session.CurrentModel

                solid = Ctype(model,IpfcSolid)

                f1 = solid.GetFeatureByName("Hole 1")

                'f1 = solid.GetFeatureById(67)

                sup = f1.CreateSuppressOp()     ------------------------------------here i am getting error  (Object reference not set to an instance of an object)---------------------

                f1.CreateSuppressOp()

                op.Append(sup)

                solid.ExecuteFeatureOps(op, Nullable)

End if

Thnks

Balaji.S

seems you are not getting feature object into variable f1 by API GetFeatureByName. Check return status of this API.

Hi,

I faced issue with API GetFeatureByName earlier. I checked and faced same again that even though Hole 1 is present, API does not give object of same by API GetFeatureByName.

I tried something as below and worked for me:

Dim objFeature As IpfcFeature

Dim objSupOp As IpfcSuppressOperation

Dim objFeatures As IpfcFeatures = objSolid.ListFeaturesByType(True, EpfcFeatureType.EpfcFEATTYPE_HOLE)

For intCnt As Integer = 0 To objFeatures.Count - 1

objFeature = objFeatures.Item(intCnt)

objSupOp = objFeature.CreateSuppressOp()

Next

Only limitation is that all holes into a part will be considered for supress operation by above code. Benefit is that you don't have to worry about what is Feature ID of hole feature to pass it into API GetFeatureByID.

Hi Ketan,

Sorry for the delay in replying to your mail.

I went meeting just now I seen your mail, I am trying with specific id based and I will try with your method of coding also.

I will let you know the status shortly.

Thnks

Balaji.S

  Hi Ketan,

Yes, You said correct for getting feature object into variable error.

I tried your method and my old one also, both options are working.

Thanks lot for your support

Please check below method coding correct…

Dim f1 As IpfcFeature

Dim sup As IpfcSuppressOperation

Dim op As New CpfcFeatureOperations

Dim rsup As IpfcResumeOperation

Method-1

'-------------------------------------

solid = session.CurrentModel

Dim objf As IpfcFeature

Dim objs As IpfcSuppressOperation

Dim objff As IpfcFeatures

objff = solid.ListFeaturesByType(True, EpfcFeatureType.EpfcFEATTYPE_HOLE)

For inc As Integer = 0 To objff.Count - 1

MsgBox(objff.Item(inc).FeatTypeName.ToString())

    objf = objff.Item(inc)

    objs = objf.CreateSuppressOp()

    op.Append(objs)

    solid.ExecuteFeatureOps(op, Nothing)

Next

'--------------------------------------------

Method-2

'------------------------------

solid = session.CurrentModel

f1 = solid.GetFeatureById(67)

If f1.Status.ToString() = "0" Then

            sup = f1.CreateSuppressOp()

            op.Append(sup)

            solid.ExecuteFeatureOps(op, Nothing)

ElseIf f1.Status.ToString() = "5" Then

            rsup = f1.CreateResumeOp()

            op.Append(rsup)

            solid.ExecuteFeatureOps(op, Nothing)

End If

'------------------------------


Thnks

Balaji.S

Hi Ketan,

Above method coding is correct?

Thnks

Balaji.S

Method 2 is best to use when you now ID of feature and is not going to change through out application scope.

Hi Ketan,

Thank you for your reply, i will update in my coding part.

Thnks

Balaji.S

Hi Ketan,

How are you, how is going...

Currently I am connecting creo 2.0 using the below method-3 only.

But, now i try with connect method (1,2), if i try that method it shows error (pfcExceptions::XToolkitNotFound)

Dim asyncConnection As IpfcAsyncConnection

Dim cAC As CCpfcAsyncConnection

Dim session As IpfcBaseSession

Dim objccpfcconnection As New CCpfcAsyncConnection

Dim exePath, workDir

exePath = "C:\Program Files\PTC\Creo 2.0\Parametric\bin\parametric.exe"

workDir = "C:\Program Files\PTC\Creo 2.0\Common Files\F000\vbapi\vbapi_examples\models"

Try

                'Method-1         

                _objIpfcConnection = objccpfcconnection.Connect(Nothing, Nothing, Nothing, Nothing) - pfcExceptions::XToolkitNotFound

                session = asyncConnection.Session

                session.LoadConfigFile("C:\Users\Public\Documents\config.pro")

                'Method-2

                '_objIpfcConnection = objccpfcconnection.Connect(DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value)-pfcExceptions::XToolkitNotFound

                'session = asyncConnection.Session

                'session.LoadConfigFile("C:\Users\Public\Documents\config.pro")

                'Method-3

                'cAC = New CCpfcAsyncConnection

                'asyncConnection = cAC.Start(exePath + " -g:no_graphics-i:rpc_input", workDir)

                'session = asyncConnection.Session

                'session.LoadConfigFile("C:\Users\Public\Documents\config.pro")

Catch ex As Exception

                MsgBox(ex.Message)

Finally  

End Try

I configured creo 2.0 parametric as per guide instructions only.

Please tell me where i done mistake.

Thanks

Balaji.S

better to start new discussion thread for this.

Ok

Sorry Ketan,

Hi ketan,

New discussion thread url

Creo 2.0 Parametric connection error - VB.NET

Thnks

Balaji.S

I know its years later, but for anyone else wondering why this won't work refer to this:


Pro/ENGINEER Wildfire 5.0 introduces the No-Resolve mode, wherein if a model and feature regeneration fails,
failed features and children of failed features are created and regeneration of other features continues. However,
VB API does not support regeneration in this mode. The method pfcSolid.Solid.Regenerate throws an
exception IpfcXToolkitBadContext, if Creo Parametric is running in the No-Resolve mode. To continue with the
Pro/ENGINEER Wildfire 4.0 behavior in the Resolve mode, set the configuration option regen_failure_handling
to resolve_mode in the Creo Parametric session.

 

Top Tags