Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IFRs on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Dumb Rules in journals 1

Status
Not open for further replies.

Twullf

Mechanical
Jan 24, 2012
196
I have a recorded journal, which I simplified and successfully tested. the section in question reads as follows:

Code:
scCollector2 = extractFaceBuilder3.FaceChain

faces2(0) = face1
faceDumbRule2 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces2)

faces3(0) = face3
faceDumbRule3 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces3)

rules4(0) = faceDumbRule2
rules4(1) = faceDumbRule3
scCollector2.ReplaceRules(rules4, False)

extractFaceBuilder3.FixAtCurrentTimestamp = True

feature3 = extractFaceBuilder3.CommitCreateOnTheFly()

I wish to pass an array of values, so I changed it in my program as follows:

Code:
      scCollector2 = extractFaceBuilder3.FaceChain

      itm2 = checkFace.Length - 1

      Dim rules4(itm2) As SelectionIntentRule

      For itm1 = 0 To itm2
         faces1(0) = checkFace(itm1)
         faceDumbRule1 = workPart.scRuleFactory.CreateRuleFaceDumb(faces1)
         rules4(itm1) = faceDumbRule1 
      Next itm1

      msgbox("Rule4 Set")

      scCollector2.ReplaceRules(rules4, False)

      extractFaceBuilder3.FixAtCurrentTimestamp = True

      feature3 = extractFaceBuilder3.CommitCreateOnTheFly()

The code successfully appears to complete everything up to the message box saying "Rule4 Set." However where the previous code had no problem with the commitCreateOnTheFly now it fails.

I was hoping that the values would be set in the array and using the DumbRule multiple times would not make a difference, but suspect that is where I'm failing.

Does rules4(0) = faceDumbRule2 actually save the variable name? so each instance of Rules4() have to have an individual variable left alone for it to access? Or does my problem lie else where.

Thank you for your time.
 
Replies continue below

Recommended for you

Are you selecting multiple faces for a single extract face feature? If so, you can pass in the entire array of faces when you create the rule. Something like:

Code:
Dim myFaces() As Face
'... code to add desired faces to array
Dim faceDumbRule1 As FaceDumbRule
faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(myFaces)

Dim rules1(0) As SelectionIntentRule
rules1(0) = faceDumbRule1
extractFaceBuilder1.FaceChain.ReplaceRules(rules1, False)

If you are looking to create multiple extract face features, then this approach may not work...

www.nxjournaling.com
 
I have multiple faces.

I'm going to be using the intersection curve to measure the distance between two sheet bodies on a complex surface and need to be able to move it through the length of the part without having to reselect.

thanks
 
I'm getting an error saying "Selected faces will create more than one output body.

I'm not sure this is entirely due to this section of code anymore as I discovered that the code I thought was working, which I simplified from the recorded journal, is not creating an intersection curve but instead creating a spline.

Further investigation proceeding to see if I can narrow down the issue.
 
Are you creating an intersection curve feature? If so, the underlying geometry is generally a spline; perhaps the output is correct.

www.nxjournaling.com
 
I got the line to create now using your previous solution, but the problem is that despite a line saying associative = true, I am still getting a spline. Which is unassociative.

I'm near the point of posting the whole sub to see if some one else can find what I have forgotten.

thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor