FindObject Problem

Hello, I'm new for Journal programing and stuggling on two cases below to resolve FindObject problem. In order to make my program generic, I replaced CType,FindObject which were produced during recording with For-each-Loop. But, it doesn't work. Please help me to resolve the situation.

Thank you in advance,
Kazu

******************
*** First Case ***
******************

Dim measure1 As measure
measure1 = measureRectanglarExtream1.CreateFeature()
'----------------------------------
'Dim toppoint As Point = Ctype(measure1.Findobject("POINT 1"),Point)
'----------------------------------

'--- I added "For each loop" below instead of Ctype,Findobject
For each toppoint as Point in measure1
lw.WriteLine(" In the Loop ")
Next

' Do SectionCurveBuilder using toppoint

*******************
*** Second case ***
*******************

' extrude1 below was produced from ExtrudeBuilder
Dim extrude1 As feature.Extrude
'----------------------------------
'Dim face1 As face = Ctype(extrude1.Findobject("FACE 160{(x,y,z) EXTRUDE(89)}",Face)
'----------------------------------

'--- I added For each loop below instead of Ctype,Findobject
For Each face1 As Face in extrude1
lw.WriteLine(" In the Loop ")
Next

' Do OffSetSurfaceBuilder using face1

When you record a journal, it hard codes the journal identifier of any objects that you selected during the record process. When you replay the journal it will only operate on the objects that it initially recorded. The NX help docs refer to this as the "journal stickiness" problem. You can edit the code to remove these hard coded ID's, allowing the journal to operate on other objects in other files. When you do this, you need to provide an alternate way to specify which object(s) the journal should operate on. Two common methods are to allow the user to select an object or provide an algorithm so the journal can decide which object to use.

In your first case, it looks like you want to pass in a point object to the measure function. The "for each" loop in your code does not run because "measure1" does not contain any points. You will need to identify which point in the model that you want to pass in to the measure function. If the point of interest is the only point object on a certain layer, the journal code could search through the part's .Points collection looking for the proper point. If the point has no good unique way to identify it on its own, you could give the point a unique name or attribute that the journal could then look for.