Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need a help in Ilogic rule

14 REPLIES 14
Reply
Message 1 of 15
tspeed
1214 Views, 14 Replies

Need a help in Ilogic rule

Hi, i am writing a rule to extract the sheet metal flat pattern extents details and add it as user parameter. I already done this part. Now, i want to create rule to check the part is sheet metal or Solid component. I want to execute certain commands based on part property. If sheet metal, then it should select base quantity as extents area and add Sheet metal term in iproperties catagory option.

 

If part is not sheet metal, then it should check wheather part is flat bar or Rod. If flat bar, then it should set the base quantity as length from user parameters and add term "Flat Bar" in iproperties catagory option.

 

If part is rod, then it should set the base quantity as length from user parameters and add term "Rod" in iproperties catagory option.

 

pls help me to create the rule

 

Thanks,

Regards,

Jagan

 

14 REPLIES 14
Message 2 of 15
cwhetten
in reply to: tspeed

Post the rule that you have so far.  What specific parts are you struggling with?

 

Cameron Whetten
Inventor 2012

Message 3 of 15
tspeed
in reply to: cwhetten

Thanks, Cameron

 

I have attached the rule which i written to perform those functions. I am begineer to vb and just compiled few codes from different post. Let me know if u need any other details

 

thanks,

Jagan

Message 4 of 15
tspeed
in reply to: tspeed

anyone can help me ?

 

Jagan

Message 5 of 15
cwhetten
in reply to: tspeed

I am looking over your code now, but I thought I should mention one thing.  It is not possible to set the BOM base quantity to a parameter with units of area.  It must be either a linear length, a volume, or a mass.  I don't know why, but this is the way it is.

 

Does this change how you want to do things?

 

Cameron Whetten
Inventor 2012

Message 6 of 15
mikejones
in reply to: cwhetten

If the area value is writen to an iProperty; Custom iProperty called Area for example, then the quantity column in the parts list could substitute the quantity value with the Area iProperty when the fiield is available. I do this quite a lot with parts lists.

 

Mike

Autodesk Certified Professional
Message 7 of 15
tspeed
in reply to: mikejones

Mike, Thanks for your reply. I thought that only user parameters can be viewed in part list. For that, i am trying to bring custom property into user paremeter.

If you substitute the quantity value with area iproperty, then pls let me know the code to perform the function.

One more thing, is it possible to extract the one of user parameter and enter in category as P-G_T-MS format. I want to extract the thickness of sheet metal and label it.

I have wrote the code to perform this function, however i am getting few problems in execution.

Thanks for your time and help

Jagan
Message 8 of 15
tspeed
in reply to: cwhetten

Mr. Cameron, I think we can set the base quantity as area however we can't set with units. I need to extract the figure only. Using the present code, i can capture the area size and enter into ipropetries. Now, i am looking for a code to create a new user parameter and replace with captured value.

let me know if you have doubt,

Jagan
Message 9 of 15
cwhetten
in reply to: tspeed

Hi.  I just wanted to let you know I haven't forgotten about your post.  I am looking at your code again to see how I can help.

 

What version of Inventor are you using?

 

Are you using iLogic, or are you trying to write a VBA macro?

Edit:  Nevermind.  The title of this thread tells me you are using iLogic.  But it is still important to know which version of Inventor.

 

Cameron Whetten
Inventor 2012

Message 10 of 15
cwhetten
in reply to: tspeed

In the word document you attached above, you had these questions:

 


@tspeed wrote:
I am not sure declaration for BaseQuantity. Based on codes posted on another forum, I have compiled this code to perform my action. I want this highlighted box code to perform three cases

 

  1. If part is sheet metal, then select thickness value for category tab and set basequantity as sExtArea
  2. If part is not sheet metal, then part is either flat bar or round bar
  3. If part is flat bar, then select thickness value for category tab and set basequantity as length
  4. If part is Round bar, then select Outer diameter value for category tab and set basequantity as length

Pls help to clear the problems.



In order to change the BaseQuantity for a part, add these three lines of code AFTER you have created the user parameter called sExtArea:

 

Dim osExtAreaParam As Parameter
sExtAreaParam = oUserParams.Item("sExtArea")
oSMDef.BOMQuantity.SetBaseQuantity(kParameterBOMQuantity, sExtAreaParam)

 

You would modify these lines as needed for the different base quantity parameters.

 

How are you telling Inventor that the part is either a flat bar or a round bar?

 

I'm not really sure what you are trying to do with the category property.  In the code you posted there is a line that goes like this:

 

iProperties.Value("summary", "category") = "= P-thickParam-MS"

 

If you replace it with the following line:

 

iProperties.Value("summary", "category") = "= P-<Thickness>-MS"

 

then you get this:

 

category property 1.PNG

 

Putting the name of the thickness parameter (Thickness for a sheet metal part) in angled brackets will substitute the value of that parameter in the iProperty field.  In order for this to work, the thickness parameter must be exported first.  If this is what you are trying to do, we can look into writing the rule so that it sets the parameter for export if it isn't already.

 

Cameron Whetten
Inventor 2012

Message 11 of 15
cwhetten
in reply to: tspeed

I have attached a word document that shows all of the changes I made to your rule to get it to work.  The changes are denoted as follows:

 

Red = changed

Red with strikethrough = removed from rule

Green = added to rule

Blue = comments only, not rule changes

 

I have also attached a txt file of the rule with all changes integrated.

 

Cameron Whetten
Inventor 2012

Message 12 of 15
tspeed
in reply to: cwhetten

Mr. Cameron, Thank you so much for your help and time. Your code works fine but i found out some issues. Between, i am using Inventor 2011. Pls see the issues below

 

1. Code to set base quantity works fine. It does job correctly

 

2. Code to extract thickness and set the value in category also works fine. Initially, i came across one issue. In sheet metal model, i always declare the thickness as G_T in user parameter, then set sheet metal thickness as G_T. Ii want the code to extract the sheet metal parameters not to do in user parameter. Anyway, i solved this issue by checking the  option export parameter or declaring the thickness as thickness in user parameter. Either way it works fine.  Do you have idea why it occurs like tat ?

 

I am not doing anything with category. I am trying this code to automate the material stock number for each part. Now, i changed the code to set in Stock number option.

 

3. Yes, i have thought about it. I am thinking to use combox or radio button to specific the material type. Materials type might be Plate, Flat bar, Channels like C, I, Angle Bar, Rod, Rube,etc. Based on user input in radiobox option, it will extract specific parameters and set in required format for each material type.

 

4. Everytime, when i run the rule it keeps on acculumate the sheet metal extents parameters. I have attached the screenshot.  i want to check the parameters availability, if not then add it. I can't figure out missing code to block this issue. Pls check it.

 

5. Last thing, i want to run this in big assembly. Can i integrate it as single rule and run it inside assembly ? Else create simple rule to instruct excution of specific rule in each part ? any idea to do it

 

many thanks for your help

 

Regards,

Jagan.

 


.

Message 13 of 15
tspeed
in reply to: tspeed

One more thing, the unit for extents area suppose to be mm2 but i can't the unit type as mm2 in code. Do you have idea about it. Presently, it shows area as mm in parameter tab. Pls let me know your idea. Jagan
Message 14 of 15
cwhetten
in reply to: tspeed


@tspeed wrote:

2. ...Ii want the code to extract the sheet metal parameters not to do in user parameter. Anyway, i solved this issue by checking the  option export parameter or declaring the thickness as thickness in user parameter. Either way it works fine.  Do you have idea why it occurs like tat ?



I'm sorry, but I don't understand the issue.  Can you explain it again?

 


@tspeed wrote:

4. Everytime, when i run the rule it keeps on acculumate the sheet metal extents parameters. I have attached the screenshot.  i want to check the parameters availability, if not then add it. I can't figure out missing code to block this issue. Pls check it.



I don't know why it would do this.  The code as I wrote it does not do this.  Can you post your code?


@tspeed wrote:

5. Last thing, i want to run this in big assembly. Can i integrate it as single rule and run it inside assembly ? Else create simple rule to instruct excution of specific rule in each part ? any idea to do it



It may be possible to run something like this in an assembly.  I'll have to look into that.

 


@tspeed wrote:

One more thing, the unit for extents area suppose to be mm2 but i can't the unit type as mm2 in code. Do you have idea about it. Presently, it shows area as mm in parameter tab. Pls let me know your idea. Jagan

 


Yes, this is possible.  See the changes below:

 

area units.PNG

 

Note that the line that sets the base quantity to the area parameter will no longer work, because mm^2 is not a valid unit for base quantity.  So you will have to suppress or delete this line.

 

Cameron Whetten
Inventor 2012

Message 15 of 15
tspeed
in reply to: cwhetten

Thanks for your prompt reply Mr. Cameron.

I had problem in extracting the thickness value. If i set G_T as user parameter for thickness, then code unable to recognize it and it comes out like P--MS (missing thickness value). Suppose, if i changed term "G_T as Thickness" in user parameter, then code can recognize it and outcomes as P-10-MS. I thought the code will capture the value from sheet metal parameters and not from user parameters. Make sense ? Anyway i figure out this issue and got solution.

Sorry. It works fine. I am not sure about initial error. Thanks for your time.

Next, i am trying to write a code to execute this rule in single assembly. Hope i need your help 🙂

I think, then it will be problem for me to group the stock number. If i can't set the base quantity, then i need to perform those actions in excel sheet after export. Any solutions or idea ?

I would be grateful to you. Thank you so much for your help and time.

Do you suggest any links or books to study about ilogic rule ?

Regards,
Jagan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report