Adding title block depending on part's material (iLogic).

Adding title block depending on part's material (iLogic).

Anonymous
Not applicable
801 Views
6 Replies
Message 1 of 7

Adding title block depending on part's material (iLogic).

Anonymous
Not applicable

Hi,

I'm trying to make an iLogic rule with the function on adding a different title block just depending on part's material when I insert it into the drawing. I want to do this because each type of material has a different thermal treatment and hardness, characteristic that I'd added on drawing's iPorperties.

I know that I can add an automatic box in the title block, but every time I have to modify the title block by selecting the custom-iProperty.

 

I did this "rule" but my knowledge is short of iLogic, so I would like to get your help.

Thanks.Immagine1.png

0 Likes
Accepted solutions (1)
802 Views
6 Replies
Replies (6)
Message 2 of 7

dutt.thakar
Collaborator
Collaborator

@Anonymous 

Based on your rule only, I am trying to provide you a solution, I am not in front of the Inventor now.

 

I would suggest you a different approach for this, Currently, you are trying to access material of component from a drawing which will give you an error, for that case you can create a Text parameter (e.g. TitleBlock) in the assembly that will be placed on the drawing and use the same rule in that assembly, see below an example.

 

If iProperties.MaterialOfComponent("Part-1") = "AISI 316"

Parameter("TitleBlock") = "ISO" ' the values must exactly match with your title block e.g. ISO or IMS_commerciale etc.

Else If iProperties.MaterialOfComponent("Part-1") = "AISI 304"

Parameter("TitleBlock") = "IMS_commerciale"

End If
RuleParametersOutput()
InventorVb.DocumentUpdate()

iLogicVb.UpdateWhenDone = True

Once you have your rule set here in assembly what you can do is in drawing you can create a rule like below. That will access the parameter in the assembly that you have created (TitleBlock) and update it.

 

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
ActiveSheet.TitleBlock = Parameter(modelName & ".TitleBlock")

Another tip from my end, whenever you are working with iLogic, please not try to use default names, for example, in your rule you are using

 

iProperties.MaterialOfComponent("part1:1"

 

Please note that when you do copy design/ create a new assembly with different part names this name will change and iLogic will fail, so I would suggest you change the name of components you see in the assembly browser, for example instead of "part1:1", rename it to "Part-1" (i.e. remove :1, :2 that you see), by doing this your iLogic will never fail even if you copy this assembly with child parts and change their filenames.

 

Hope you will find this helpful.

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 3 of 7

Anonymous
Not applicable

Thanks for your reply @dutt.thakar 

I'm trying to make the rule work but I can't get it to work.
What name should go here iProperties.MaterialOfComponent("Part-1")? because I have tried with the name of the part, the file and the iPart component but it doesn't work.
Besides, I don't know if I have understood it well:
-I have to copy this rule in the .ipt or .iam file, creating a text parameter with the name of the material of the part and that will have connection with the TitleBlock, right?
-Then, I have to copy the second rule that you have written for the drawing, which will be the one that chooses the TitleBlock according to the parameter selected by the previous rule.

 

Thanks for your time, kind regards.

0 Likes
Message 4 of 7

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

What name should go here iProperties.MaterialOfComponent("Part-1")? 

           - The name that you see in the browser (see snap)

           - Another note here if you are using iPart, I would recommend not to use iLogic here.

 

Browser name.PNG

 Secondly, you will create a new parameter named "Titleblock" in assembly which has values of "ISO" etc. that will change based on your material from iLogic.

 

Yes and then you have to copy the second rule in drawing and it will change the title block from the "Titleblock" parameter in the model.

 

If you still can not get it work, reply and I will try to create a demo for you.

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 5 of 7

Anonymous
Not applicable

I'm sorry but it still doesn't work and I don't know why.

 

2.png1.pngImmagine4.png3.png

 

And also I don't know how to add more values in Parameters for TitleBlock.

 

Thanks again Dutt Thakar.

0 Likes
Message 6 of 7

dutt.thakar
Collaborator
Collaborator
Accepted solution

@Anonymous 

I have observed from the images that, you have not placed a view in your drawing in which you have created the parameter. You will get an error in drawing until you will not place the base view of the same part in which you have created the material rule. I have created a screencast below for replicating the same behavior and it is working as expected. See the below video and try again with your part, make sure you first place a view of the same model in which you have the material rule, and then try running the code.

 

https://knowledge.autodesk.com/community/screencast/d8a9fbf0-301e-427f-84ad-d13cf6d235e6

 

Hope this will be helpful.

 
If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 7 of 7

Anonymous
Not applicable

Many many many thanks Dutt Thakar, now it is working.

I think the problem was that I didn't run the rule. You cannot see the part placed in the drawing because I deleted it.

 

Thanks again for your time and yout attention. My 10ns for you 🙂

0 Likes