iLogic rule to change Title Blocks

iLogic rule to change Title Blocks

Anonymous
Not applicable
12,649 Views
21 Replies
Message 1 of 22

iLogic rule to change Title Blocks

Anonymous
Not applicable

Hello,

 

I can't for some reason get this rule to work, simply want to be able to choose what title block to use.

I created a text parameter with the multi-values: TES ELE and TES EQU

I have 2 title blocks in my template called TES ELE and TES EQU

Here is my code, basically, I want to rule to apply the title block based on the selection, which will be done on a form.

If Title = "TES ELE" Then
ActiveSheet.TitleBlock = "TES ELE"

ElseIf Title = "TES EQU" Then
ActiveSheet.TitleBlock = "TES EQU"

End If

InventorVb.DocumentUpdate()

ThisApplication.ActiveView.Fit

 I have found many threads in this forum and have used their solutions for this rule, but for some reason, my rule will not select the title block and place it in the drawing.

Here is a snap of my set-up and my template file is attached

title block.png

 

 

Thanks!

Accepted solutions (1)
12,650 Views
21 Replies
Replies (21)
Message 2 of 22

mikejones
Collaborator
Collaborator

Hi Sean

 

You need to specify the parameter call

 

If Parameter ("Title") = "TES ELE" Then
ActiveSheet.TitleBlock = "TES ELE"

ElseIf Parameter ("Title") = "TES EQU" Then
ActiveSheet.TitleBlock = "TES EQU"

End If

InventorVb.DocumentUpdate()

ThisApplication.ActiveView.Fit

 

Mike

 

Autodesk Certified Professional
0 Likes
Message 3 of 22

Anonymous
Not applicable

Hey Mike, I tried this as well and I still get errors when trying to run the rule??

error-title1.png

 

error-title2.png

 

I used this code and there is properly named title blocks in my drawing template and a text parameter with the matching values as well.

 

If Parameter ("Title") = "TES ELE - A" Then
ActiveSheet.TitleBlock = "TES ELE - A"

ElseIf Parameter ("Title") = "TES ELE - B" Then
ActiveSheet.TitleBlock = "TES ELE - B"

ElseIf Parameter ("Title") = "TES EQU - A" Then
ActiveSheet.TitleBlock = "TES EQU - A"

ElseIf Parameter ("Title") = "TES EQU - B" Then
ActiveSheet.TitleBlock = "TES EQU - B"

End If

InventorVb.DocumentUpdate()

ThisApplication.ActiveView.Fit

 template.png

 

I don't understand, haha, why won't the rule display the selected title block?

 

Thanks!!

0 Likes
Message 4 of 22

mikejones
Collaborator
Collaborator

Sean

 

Does your title block contain prompted entries by any chance?

 

Mike

Autodesk Certified Professional
0 Likes
Message 5 of 22

Anonymous
Not applicable

Yes!!?? There is one instance, but if that is an issue, I can rid of it...

 

Thanks

0 Likes
Message 6 of 22

mikejones
Collaborator
Collaborator
Accepted solution

Sean there is a different call for tilte blocks which contain prompted entries

ActiveSheet.SetTitleBlock("Other Title Block", "promptedEntry1", "promptedEntry2")

 

Mike

Autodesk Certified Professional
Message 7 of 22

Anonymous
Not applicable

Hey Mike,

 

I just got rid of the prompted entry and used the comments iproperty in the model to insert the info that i need.

 

That being done, the rule didn't work, but there was no errors, so I changed the rule code back to this:

If Title = "TES ELE - A" Then
ActiveSheet.TitleBlock = "TES ELE - A"

ElseIf Title = "TES ELE - B" Then
ActiveSheet.TitleBlock = "TES ELE - B"

ElseIf Title = "TES EQU - A" Then
ActiveSheet.TitleBlock = "TES EQU - A"

ElseIf Title = "TES EQU - B" Then
ActiveSheet.TitleBlock = "TES EQU - B"

End If

InventorVb.DocumentUpdate()

ThisApplication.ActiveView.Fit

 

and it now works.

 

I just need to create a rule now that will prompt my Form once the drawing template is opened and I can select my drawing sheet parameters: Units -> Sheet Size -> Company Title Block

 

Form.png

 

Thanks for your help Mike!!

 

 

0 Likes
Message 8 of 22

mrattray
Advisor
Advisor
You just need to use a one liner rule (there is a snippet for it in the default snippets under forms). Then add this one liner rule to the event triggers under "New File".
Mike (not Matt) Rattray

Message 9 of 22

Anonymous
Not applicable

Hi,

I have a similar task: to choose one of two title blocks depending on a parameter entered in a form. My iLogic rule:

iLogicForm.Show("Drawing parameters")

If TitleBlock = "A" Then
ActiveSheet.TitleBlock = "TitleBlock A"
ElseIf TitleBlock = "B" Then
ActiveSheet.TitleBlock = "TitleBlock B"
End If

 

It works, but the problem is that I have to run the rule 2 times to change a title block. When I run the rule for the first time with changed parameter "TitleBlock" it doesn't change the title block. After second run it changes. Why this problem appears?

0 Likes
Message 10 of 22

Anonymous
Not applicable

Yea I was kind of ignoring this issue, but or some reason, when you open your template, if the titleblock you want is the one that is already selected upon opening you have to pick the other titleblock then re-pick the initial titleblock, I don't know how to bypass this or this made sense.

 

In my example I have 4 different titleblock,

 

  • Elect A
  • Elect B
  • Equip A
  • Equip B

 

when I open the drawing template Elect A is first in the list(first by default)

 

If I want any of the other 3 titleblocks, the rule runs fine, but if I do in fact want Elect A to be the titleblock, it won't apply on the first run of the rule, I have to select one of the other 3, then apply, then re-select Elect A and press apply to get that titleblock.

 

The only solution I could think of was to create another blank parameter(titleblock), and make sure that one is selected first by default then if I want Elect A is would apply on first try..

 

 

0 Likes
Message 11 of 22

mrattray
Advisor
Advisor
You're cheating. You need to have the LogicForm.Show line in a separate rule. The way it is currently written, the rule does not wait for user input before setting the title block.
So, to correctly configure this: You need two rules. One should contain only the show form line and should be listed under event triggers for new file. The second rule will contain the rest of the title block setting code and should be fired by a button embedded in your form. This will force the code to wait for user input before setting the title block.
If it doesn't make sense I can post some pictures.
Mike (not Matt) Rattray

0 Likes
Message 12 of 22

Anonymous
Not applicable

hmmm..I do have a separate rule for the form to show...I would upload my template but it is 2014, do you have that?

 

I created a short (30sec video) of what I mean,

  • in the video you will see that my titleblock Equipment B is the default upon opening the template
  • I can't use Equipment B off the getgo because the apply button is greyed out
  • But if i select a different titleblock, then re-select the Equipment B title block, the apply button becomes active, but even after pressing it, the Equipment B titleblock does not apply to the drawing sheet
  • I have to acutally apply a different titleblock to the drawing sheet, then go back to Equipment B and apply it,

This can be seen in the video uploaded in the link here: http://screencast.com/t/JrAwBrweOydv

 

This also wasn't a major concern, because I don't always create Equipment B drawings, (roughly 25% of the time) so if/when I do create an Equipment B drawing, I just use the work around as seen in the video, only takes a few seconds.

 

That being said, if there is a simple solution to this, I would apply it.

 

Thanks!

0 Likes
Message 13 of 22

mrattray
Advisor
Advisor
2211285, Are your rules set up like I said? It was your post that really inspired my comment. Welcome to the forums, by the way.
Sean, I do have 2014 loaded. If you upload your template file I'll take a look.

P.S. It looks like 2211285 deleted the post I was replying to right as I was posting.
Mike (not Matt) Rattray

0 Likes
Message 14 of 22

Anonymous
Not applicable

Yea, he posted something saying were not talking about the same issue, I thought it was for some reason, anyways, here is my template file,

 

Thanks

0 Likes
Message 15 of 22

Anonymous
Not applicable

Thanks! I made a separate rule for the form and it works now. But the other problem appears - I want the form to disappear after pressing a button. How to implement this?

P.S. I've posted a message before reading your answers, but when I read your answer I removed my post. You are replying quite quick.

0 Likes
Message 16 of 22

mrattray
Advisor
Advisor
In the form editor under the properties for the button is a drop down option for what to do when the button is clicked. You want : "Apply, then Run, then Close".
Mike (not Matt) Rattray

0 Likes
Message 17 of 22

Anonymous
Not applicable

Perfect! Thanks!

0 Likes
Message 18 of 22

mrattray
Advisor
Advisor

I made some changes. See how this works. It is a similar problem to 2211285's.

 

Edit: Forgot to attach.

Mike (not Matt) Rattray

Message 19 of 22

Anonymous
Not applicable

Yup! that update button works much better than the apply button!


Thanks!!

 

Only thing left I would like to do is play with the images, not sure if you noticed by the template is 1.2MB with no views on it...

I know the template has a bunch of iLogic in it, but the images are not the best either. I deleted the images from the template completely and the size dropped to 500kb...I heard something rumored about using vector images instead of bmp, but I'll look into that another day.

 

For now this template has been working great!!

 

Thanks again Mike!

 

 

0 Likes
Message 20 of 22

mrattray
Advisor
Advisor
I didn't notice the bloat, but I would definitely suspect embedded images before code. I've used files with way more iLogic than that and didn't experience any file bloat; it's just text, after all. Could you use an externally linked image instead of an embedded one?
Mike (not Matt) Rattray

0 Likes