Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Extracting feature data from the VB API

prcdslnc13

New member
Im working on a project to extract Weld Feature data and feature parameter data from creo 2.0 with python and the VB API. The eventual output of these will go out to excel 2010 and possibly a .xml file but thats to be determined.

At this point I am able to extract the feature parameter data, but not the feature type or name. Basically my code parses the model looking for specific feature types and then pulling parameter data from them and exporting them. But I cannot figure out how to pull the ID of the feature with it. Does anyone have any guidance?

Also I am suddenly getting this error from my code it seems to be an issue with connecting to the COM service. CreoError.jpg
 
I think you can use it following way -
currentComponent.ListFeaturesByType(True, EpfcFeatureType.<Feature Type you want>)

HTH
 
Well I am doing that currently to pull features in to look at them like the following
Code:
filletWeldsList = model.ListFeaturesByType(True,138) #138 is id for filletweld type

Note that I am working on this project in python so the syntax is a little different.

So 138 is the code for the feature type. But I need the Feature ID of the feature I am currently looking at. PTC helpdesk told me to try
Code:
IpfcModelItem.Id
but I am having trouble implementing it now.
 
Hello prcdslnc13,

Could you help me using the vb api with python? I tried but I get the "no module named IpfcAsyncConnection" error.
my code is as follows:

import win32com.client as win32
asyncconn = win32.gencache.EnsureDispatch("pfcls.pfcAsyncConnection")
conn = asyncconn.Connect(None,None,None,None)
session = conn.Session
mdlname = session.CurrentModel.FileName
print mdlname
 
Hello prcdslnc13
Could you help me with the connection to CREO using Python please?
I used the following Python code without success:

import win32com.client
import sys
asyncconn = win32com.client.dynamic.Dispatch("pfcls.pfcAsyncConnection") # This line executes without problem...
conn = asyncconn.Connect(None,None,None,None) #The code crashes here saying there is no AsyncConnection method
session = conn.Session
mdlname = session.CurrentModel.FileName

The CREO API works without problem with VB.net, and Perl, so I think the API settings are good.

I need help please!!! Someone!!

Stephane
 

Sponsor

Articles From 3DCAD World

Back
Top