Set PunchToolFeature PunchID

Set PunchToolFeature PunchID

Anonymous
Not applicable
561 Views
3 Replies
Message 1 of 4

Set PunchToolFeature PunchID

Anonymous
Not applicable

Writing a routine to insert PunchTools and wanting to set the punchID at insertion time. Can get the tool to insert no problem but can only find the PunchID as a property of the ifeature and its read only. Any suggestions on how to do this?

 
 

SheetMetalComponentDefinition smdef = (SheetMetalComponentDefinition)sheetMetalPart.ComponentDefinition;

SheetMetalFeatures smfeatures = (SheetMetalFeatures)smdef.Features;

 

iFeatureDefinition ifeatureDef = smfeatures.PunchToolFeatures.CreateiFeatureDefinition(toolFeatureLocation);


ifeatureDef.PunchId="6.35"; ///Comiler errors here with Property is read only error

 

PunchToolFeature ptf = smfeatures.PunchToolFeatures.Add(punchCentres, ifeatureDef, 0);

0 Likes
562 Views
3 Replies
Replies (3)
Message 2 of 4

sanjay.ramaswamy
Alumni
Alumni

The PunchId cannot be set at the time of insertion. It needs to be set when authoring the punch tool, or from within the .ide file. Unfortunately, you can't do either thru the API.

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Sorry Sanjay.

Maybe I ddnt explain correctly, or I have misunderstood your reply.

In my IDE, I have defined multiple rows for teh punch tool, each with a unique PunchID, and the PunchID is the only Key field.

ie

Dia PunchID

5 PID1

10 PID2

15 PID3

When I insert that tool through a native Inventor Interface, I can select which PunchID i want to use, and get the resultant punch dia. I want to replace the Manual selection of the PunchID with an API Call. See attached recording to help explain better

0 Likes
Message 4 of 4

sanjay.ramaswamy
Alumni
Alumni

Ah, I see. You are inserting a table-driven punch tool. In order to choose which row from the table gets inserted, you need to set the iFeatureDefinition.ActiveTableRow property. You need to get the desired row from the iFeatureDefinition.iFeatureTable.

 

Look for a sample titled "Place table driven iFeature in a part" in programming help. This should demonstrate what you need.

0 Likes