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

UDF Problem, advice?

UDF Problem, advice?

I'm new to creating user defined features, but I'm been muddling through and I've hit an interesting roadblock which I can't seem to get by. Upon insertion of the UDF into my "parent" part, I've noticed that a partial list of the relations that govern the model that my UDF was based on gets copied into the new model, but they're all /* (remmed out). The relations are a list of If / Endif statements that drive groove width and depth of cut, and when they're copied into the new model, all of the closing "Endif" lines are gone.

The UDF is designed to insert snap ring grooves into a shaft; the driving dimensions are user inputs for Shaft OD and Offset Distance. This is set up from the Program:

VERSION 5.0

REVNUM 3416

LISTING FOR PART EXT_SNAP_RING

INPUT

SHAFT_OD NUMBER

OFFSET_DISTANCE NUMBER

END INPUT

I've got relations that will determine the depth of cut and groove width for various different sizes of shaft OD (here are a couple of those relations)

D48=SHAFT_OD

IF SHAFT_OD==8

SR_GROOVE_DOC=0.2

SR_GROOVE_WIDTH=0.9

ENDIF

IF (SHAFT_OD <= 10 && 9 <= SHAFT_OD)

SR_GROOVE_DOC=0.2

SR_GROOVE_WIDTH=1.1

ENDIF

The part from which I made my UDF, "ext_snap_ring.prt" functions well. By this I mean that upon regeneration values are requested for the shaft od and snap ring offset distance, and the model updates accordingly. I had hoped to be able to write a mapkey that will invoke this UDF, add the required relations and the feature. It doesn't work quite as planned.

When I bring in the UDF to my test part (I just made a cylindrical protrusion of random length and diameter) I expected the relations and program to come along with it (this is what I'd like to happen) that will request shaft od and offset distance from whatever selected face upon regeneration, and just have it update. While it does bring in the relations, none of them have the Endif line (so... none of them work) and every line is remmed out:

/*IF SHAFT_OD==8

SR_GROOVE_DOC=0.2

SR_GROOVE_WIDTH=0.9

/*

/*IF (SHAFT_OD <= 10 && 9 <= SHAFT_OD)

SR_GROOVE_DOC=0.2

SR_GROOVE_WIDTH=1.1

/*

/*IF (SHAFT_OD <= 12 && 11 <= SHAFT_OD)

SR_GROOVE_DOC=0.25

SR_GROOVE_WIDTH=1.1

/*

/*IF (SHAFT_OD <= 14 && 13 <= SHAFT_OD)

SR_GROOVE_DOC=0.3

SR_GROOVE_WIDTH=1.1

/*

Maybe I'm going about this the wrong way, and I'm open to suggestion. We don't have a mapkey to make this happen, and don't support a tool box or whatever that might automate installing the snap rings with respective grooves, so if I want it to happen, I have to figure out a way to make this (or something like this) work. Please help.

I've attached the file that I'm using to create my UDF, and the UDF file itself.

1 REPLY 1

Re: UDF Problem, advice?

Ryan,

Only dimensions that are from features actually created by the UDF can be referenced by it. This is why the IF statements are getting commented out. There are of course workarounds. Probably the easiest one is to create a feature in the UDF that is then referenced by the IF statements for the actual groove feature. For example, you could create a curve that matches the OD of the shaft, then in the next feature you could reference this curve's size. I'd also recommend adding the relations statements directly to the UDF created features, not the top level. Finally, when you record the UDF make sure there are no unnecessary top level relations present. You don't want any extra "stuff" in the UDF.

I could be wrong, but I don't think a UDF can alter the Pro/Program INPUT statement...