Overriding Auto Scale in Title block

Overriding Auto Scale in Title block

Anonymous
Not applicable
3,133 Views
17 Replies
Message 1 of 18

Overriding Auto Scale in Title block

Anonymous
Not applicable

Hello, 

I have successfully installed and used the procedure outlined at the following link to auto populate my title block.

 

http://beinginventive.typepad.com/being-inventive/2013/03/adding-scale-to-title-block.html

 

Is there a way to override the scale in the title block as necessary? I would like to avoid manual supressing the rule each time.

 

Perhaps the rule could search every drawing view on a single sheet and write "Varies", or the prompted entry box could have a manual written value in the text box and avoid running the rule. 

 

I have basic code programming skills, I just dont know the inventor rule language very well.

 

Many Thanks! -JS

0 Likes
Accepted solutions (1)
3,134 Views
17 Replies
Replies (17)
Message 2 of 18

mcgyvr
Consultant
Consultant

Do you EVER measure from the paper drawing? If not just remove the scale from the title block..

Thats a carry over from the architectural world where people would actually bust out the scale and measure things in the field..

Do you really do that?

 

What about just including the scale under each base view? wouldn't that be better? And Inventor does that out of the box..

 

or just don't set the rule to trigger on any event and just manually run it when you want.. 

Writing "varies" is 100% useless IMO so why even do it... 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 18

Anonymous
Not applicable

The type of thing we build varies wildly from day to day. One day could be a plate of steel that fits full scale on the page, another is a 300' venus with columns and everything. We do indeed use a scale rule....and frequently. 

 

The "Varies" comes into shoving multiple different units on one drawing. For instance, I could have the full assembled widget, and then each smaller piece full scale next to the widget on one paper. It keeps from having to send an entire packet to the floor.

 

I think my request can be simple if somebody can take a look at the code used in the scrip and just write and "IF...ELES" statement that ignores the rest of the script if there is already a value written in the Prompted Entry box. 

0 Likes
Message 4 of 18

Curtis_Waguespack
Consultant
Consultant

Hi JonathanESeiler,

 

I understand the use of scale callouts on the views for fabrication drawings with mixed scales on the same sheet. But I'm not sure I understand this request:

 

"Perhaps the rule could search every drawing view on a single sheet and write "Varies", or the prompted entry box could have a manual written value in the text box and avoid running the rule. "

 

I would think that you would want to look at each view on the drawing and leave the drawing label for each view to display the scale, but then if more than one scale is found in those views, the titleblock scale entry is changed to read "Varies.

 

Is that what you're thinking or am I missing something here?

 

Also, is the scale field in the titleblock really a prompted entry? Or is it a field that looks at a custom iProperty? ( Generally speaking, prompted entry should be avoided. )

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

EESignature

0 Likes
Message 5 of 18

Curtis_Waguespack
Consultant
Consultant

Hi JonathanESeiler,

 

Here is an iLogic rule to check each drawing view scale on the sheet and then update a custom iProperty to show the scale if all of the views are the same scale, or show "Varies" if they are not.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Dim odrawdoc As DrawingDocument
odrawdoc = ThisApplication.ActiveDocument
customPropertySet = odrawdoc.PropertySets.Item("Inventor User Defined Properties")
iLogicVb.UpdateWhenDone = True

Try
	prop = customPropertySet.Item("Scale")
Catch
	' catch error when not found and create the iproperty
	customPropertySet.Add("", "Scale")
End Try

Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim dScale As Double
Dim sScale As String


oSheet = odrawdoc.ActiveSheet
'get first view scale
dScale = oSheet.DrawingViews.Item(1).Scale

oViews = oSheet.DrawingViews
For Each oView In oViews
'MessageBox.Show(oView.Scale , "iLogic")

	If dScale <> oView.Scale Then
		sScale = "Varies"
		Exit For
	Else
		sScale = oView.ScaleString
	End If
Next

iProperties.Value("Custom", "Scale") = sScale

EESignature

Message 6 of 18

Anonymous
Not applicable

You have perfectly understood what I was asking for. 

 

We are still running inventor 2015, so the scale is a prompted entry field currently. We may be moving to 2017 at the end of the year but I am not holding my breath. Can you adjust the code to fit that scenario? As I am sure you have already run across, the link I supplied in my original post is the script I am currently running. 

0 Likes
Message 7 of 18

mcgyvr
Consultant
Consultant

@Anonymous wrote:

You have perfectly understood what I was asking for. 

 

We are still running inventor 2015, so the scale is a prompted entry field currently. We may be moving to 2017 at the end of the year but I am not holding my breath. Can you adjust the code to fit that scenario? As I am sure you have already run across, the link I supplied in my original post is the script I am currently running. 


You just need to update your title block to have scale be from the custom iproperty "Scale"..

Note: you will need to create that custom property first in your drawing for it to be available as an option in the text dialog dropdowns..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 8 of 18

Curtis_Waguespack
Consultant
Consultant

@Anonymous wrote:

You have perfectly understood what I was asking for. 

 

We are still running inventor 2015, so the scale is a prompted entry field currently. We may be moving to 2017 at the end of the year but I am not holding my breath. Can you adjust the code to fit that scenario? As I am sure you have already run across, the link I supplied in my original post is the script I am currently running. 


Hi JonathanESeiler,

 

I think I'll have to reverse my earlier thoughts on prompted entry for this. After working through this example, it later occurred to me that using a custom iProperty would update the title block on every sheet, which would not be desired for this. Using prompted entry to hold this scale would allow each sheet's title block to update independently.

 

I'll try to provide an updated example using prompted entry in the next couple of days.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 9 of 18

Curtis_Waguespack
Consultant
Consultant

Hi JonathanESeiler,

 

Here is the updated rule. I used much of what was found at the beinginventive link you provided, and just re-worked it as I stepped through so that I understood what was going on there., and didn't miss anything.

 

I tested it a bit, but post back if you run into issues.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Sub Main
'this rule expects a prompted entry 
'in the title block with the value of: <Scale>

Dim oDrawdoc As DrawingDocument
oDrawdoc = ThisApplication.ActiveDocument
iLogicVb.UpdateWhenDone = True

Dim oSheet As Sheet
Dim oTitleBlock As TitleBlock 
Dim oView As DrawingView

Dim dScale As Double
Dim sScale As String
Dim oScaleText As TextBox
Dim oScaleString As String 
oScaleString = String.Empty


'get current sheet
curSheet = oDrawdoc.ActiveSheet

For Each oSheet In oDrawdoc.Sheets
	'get first view scale
	dScale = oSheet.DrawingViews.Item(1).Scale
	'get the title block
    oTitleBlock = oSheet.TitleBlock
    If (oTitleBlock Is Nothing) Then Continue For
    	oScaleText = GetScaleTextBox(oTitleBlock.Definition)
		
    If (oScaleText Is Nothing) Then Continue For
	
	For Each oView In oSheet.DrawingViews
		If dScale <> oView.Scale Then
			oScaleString = "Varies"
			Exit For
		Else
			oScaleString = oView.ScaleString
		End If	
			
	Next
    oTitleBlock.SetPromptResultText(oScaleText, oScaleString)
Next

'return to original sheet
curSheet.Activate

End Sub

Function GetScaleTextBox(ByVal titleDef As TitleBlockDefinition) As TextBox
     For Each defText As TextBox In titleDef.Sketch.TextBoxes
            If (defText.Text = "<Scale>" Or defText.Text = "Scale") Then
                  Return defText				  
            End If
      Next
      Return Nothing
End Function

EESignature

0 Likes
Message 10 of 18

Anonymous
Not applicable

Hi Curtis,

 

Your code is close to the end result but does not quite work as expected.

 

When editing the rule I get the following Error...

 

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

I can get past it without resolving the error, but Inventor is not happy.

 

The drawing correctly identifies that there are multiple scales, and appropriately inputs "Varies" However, when there is only one scale, it does not input the scale in the title block like the original code did. Also, When triggering the rule again on a blank sheet, the scale noted remains "Varies" 

 

Thanks for your help! I can feel how close we are to an answer!

0 Likes
Message 11 of 18

Curtis_Waguespack
Consultant
Consultant

Hi JonathanESeiler ,

 

I think the error might be related to having a sheet with no views on it.  I'll have a look at it and also make sure it handles the case "when triggering the rule again on a blank sheet, the scale noted remains "Varies" "

 

I'll try to post something back later today.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 12 of 18

Curtis_Waguespack
Consultant
Consultant
Accepted solution

JonathanESeiler wrote: 

However, when there is only one scale, it does not input the scale in the title block like the original code did.

 

Also, When triggering the rule again on a blank sheet, the scale noted remains "Varies" 

 


Hi JonathanESeiler,

 

I tested for both of these conditions and fixed the error that occurred when no view was found on a sheet, but I could not replicate the case where the code did not input the scale in the title block when there is only one scale.

 

I might have been that a sheet with not views was causing the problem, and fixing that, fixed both issues, but let me know if this revised version still does not work as expected.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Sub Main
'this rule expects a prompted entry 
'in the title block with the value of: <Scale>

Dim oDrawdoc As DrawingDocument
oDrawdoc = ThisApplication.ActiveDocument
iLogicVb.UpdateWhenDone = True

Dim oSheet As Sheet
Dim oTitleBlock As TitleBlock 
Dim oView As DrawingView

Dim dScale As Double
Dim sScale As String
Dim oScaleText As TextBox
Dim oScaleString As String 
oScaleString = String.Empty


'get current sheet
curSheet = oDrawdoc.ActiveSheet

For Each oSheet In oDrawdoc.Sheets
	'get first view scale
	Try
	dScale = oSheet.DrawingViews.Item(1).Scale
	Catch
	End Try
	'get the title block
    oTitleBlock = oSheet.TitleBlock
    If (oTitleBlock Is Nothing) Then Continue For
    	oScaleText = GetScaleTextBox(oTitleBlock.Definition)
		
    If (oScaleText Is Nothing) Then Continue For
	
	For Each oView In oSheet.DrawingViews
		If dScale <> oView.Scale Then
			oScaleString = "Varies"
			Exit For
		Else
			oScaleString = oView.ScaleString
		End If	
			
	Next
    oTitleBlock.SetPromptResultText(oScaleText, oScaleString)
Next

'return to original sheet
curSheet.Activate

End Sub

Function GetScaleTextBox(ByVal titleDef As TitleBlockDefinition) As TextBox
     For Each defText As TextBox In titleDef.Sketch.TextBoxes
            If (defText.Text = "<Scale>" Or defText.Text = "Scale") Then
                  Return defText				  
            End If
      Next
      Return Nothing
End Function

EESignature

Message 13 of 18

Anonymous
Not applicable

Hi Curtis,

 

 

Thank you!!!!!! You have saved 6 people from worrying about the title-block on all of our drawing situations. We this fix, we have automated all of the information in all of our title-blocks. Woot!  

Message 14 of 18

RSNewton59
Enthusiast
Enthusiast

Hi,

I have a similar problem (I think)

I try to overwrite the scale and insert NTS (Not to scale) as the part is so much wire and the length etc is specified in the drawing. Other information relating to the part (e.g. Part No., Description etc ) comes from the model, as you would expect. The scale box picks up the (say) 2:1 scale but as it isn't shown on the drawing as such, I want to correct it to show NTS.

I can do this in field text, I properties and Global properties and it works....

 

....right up to when I save it and  it returns back to "2:1" 😞

 

If I change the input to "yes" or "no" and select "No" then it's all good.

 

How can I make it show (or keep) the text I put in?

 

Cheers (First post so sorry if I rambled a bit)

0 Likes
Message 15 of 18

IgorMir
Mentor
Mentor

And it gets even better! The electronic file uses A3 page (for example). Then the drawing is printed on A4 piece of paper. With the scale shown somewhere in the TB. The drawing gets to the workshop and some "experienced" fella works out a missing dimension based on the measurement taken from the hard copy, multiplied by the scale factor, shown on that very drawing! Haven't anyone seen that? I had.

Cheers,

Igor.

 


@mcgyvr wrote:

Do you EVER measure from the paper drawing? If not just remove the scale from the title block..

Thats a carry over from the architectural world where people would actually bust out the scale and measure things in the field..

Do you really do that?

 

What about just including the scale under each base view? wouldn't that be better? And Inventor does that out of the box..

 

or just don't set the rule to trigger on any event and just manually run it when you want.. 

Writing "varies" is 100% useless IMO so why even do it... 

 

Web: www.meqc.com.au
0 Likes
Message 16 of 18

RSNewton59
Enthusiast
Enthusiast

Igor, I always mark the drawings "DO NOT SCALE"

As you say it's far to easy to scale off the drawing, but if the drawing has been through a reprographic process (e.g. photocopier) it will have been reduced in size by at least 1%

 

My query relates to drawings where there is no geometry on the sheet, and I don't want a physical scale shown.

0 Likes
Message 17 of 18

IgorMir
Mentor
Mentor

Hi Robert,

I am not sure - what kind of drawing is that? 🙂

 


@RSNewton59 wrote:

 

 

My query relates to drawings where there is no geometry on the sheet, and I don't want a physical scale shown.


 

Web: www.meqc.com.au
0 Likes
Message 18 of 18

Curtis_Waguespack
Consultant
Consultant

Edit:

I see you started a new separate thread. I 'll move my reply over there:

https://forums.autodesk.com/t5/inventor-forum/overriding-auto-scale-in-title-block-by-editing-i-prop...

EESignature

0 Likes