iLogic to control drawing view note.

iLogic to control drawing view note.

JimmyDoe
Collaborator Collaborator
4,235 Views
20 Replies
Message 1 of 21

iLogic to control drawing view note.

JimmyDoe
Collaborator
Collaborator

Hi everyone,

 

To start off, at my company we put multiple parts on a single drawing sheet. I know, I know, not the best way. We put a note under the initial view of each part on the drawing that looks like the attached image. Our title block gets it's scale off the' initial view scale'. So now I'm wondering if iLogic can control the visibility of the 'SCALE:' line in the view note on the rest of the parts I add to the drawing.

 

If the scale of the view I add is not the same as the 'initial view scale' I would like the 'SCALE' line to appear. And I would like it hidden if the scale of the view is the same as the initial view scale.

 

If that makes sense..

0 Likes
Accepted solutions (1)
4,236 Views
20 Replies
Replies (20)
Message 2 of 21

mcgyvr
Consultant
Consultant

Maybe something here from Curtis could help get you started..

http://forums.autodesk.com/t5/inventor-general-discussion/overriding-auto-scale-in-title-block/td-p/...

 



-------------------------------------------------------------------------------------------
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 3 of 21

JimmyDoe
Collaborator
Collaborator

Thank you mcgyvr,

 

I will look into that and see what I can do. I was hoping I would get some of Curtis' iLogic superpower 🙂

0 Likes
Message 4 of 21

Curtis_Waguespack
Consultant
Consultant

Hi JimmyDoe,

 

Coincidentally, I'm working on manipulating the drawing view labels with iLogic right now, to add item numbers to them. So I'll try and post back an example for showing/hiding the scale string to a view label a bit later.

 

In the mean time you can have a look at this link as well, as there is an example for adding and formatting the scale string to view labels:

 

https://forums.autodesk.com/t5/inventor-customization/ilogic-code-to-change-view-label-text/m-p/3633...

 

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

EESignature

Message 5 of 21

mcgyvr
Consultant
Consultant

@JimmyDoe wrote:

Thank you mcgyvr,

 

I will look into that and see what I can do. I was hoping I would get some of Curtis' iLogic superpower 🙂


Tada.. Superman is here now.. 

 

 



-------------------------------------------------------------------------------------------
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 6 of 21

Curtis_Waguespack
Consultant
Consultant

@JimmyDoe wrote:

... We put a note under the initial view of each part on the drawing that looks like the attached image.


Hi JimmyDoe,

 

I didn't see the image, but try this code. It should take whatever is in the drawing view and just add the scale as a new line.

 

I suspect it won't work for you as currently written, because if your view label is as such:

 

View 9

Scale: 1:1

 

you'll get this:

 

View 9

Scale: 1:1

(Scale: 1:1)

 

If you can post an image of what you have / want, I can tweak this.

 

(btw: just because I dress funny doesn't mean I'm a super-hero. Smiley Tongue )

 

 

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

 

 

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim dScale As Double

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
	'get first view scale
	dScale = oSheet.DrawingViews.Item(1).Scale
	oViews = oSheet.DrawingViews
	For Each oView In oViews
		If dScale <> oView.Scale Then
		oView.ShowLabel = True
		oStringScale = "<Br/><StyleOverride FontSize='0.3'>(Scale <DrawingViewScale/>)</StyleOverride>"
		'add to the view label
		oView.Label.FormattedText = oView.Label.FormattedText  & oStringScale
		Else
		oView.ShowLabel = True
		End If

	Next
Next

EESignature

0 Likes
Message 7 of 21

JimmyDoe
Collaborator
Collaborator

I was just playing around with your code from the link in your previous reply. I played around and now have it showing what I want. I took out description and mass and added stock number and a 'Qty: ' manual entry at the end.

 

Now the tricky part: Can you make it so when the rule starts, it first checks if the scale matches the 'initial view scale' and if the scale does match  then the rule is to do nothing. And if it differs, just let the rule run as it should.

 

 SyntaxEditor Code Snippet

Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.count = 0 Then
    MessageBox.Show("You must select a drawing view first", "iLogic")
Exit Sub
End If

'Reference to the drawing view from the 1st selected object
Dim oView As DrawingView = trycast(oSSet.item(1), DrawingView)

If oView IsNot Nothing Then
oView.ShowLabel = True
'format the model iproperties    
oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
oStringScale = "<Br/>SCALE <DrawingViewScale/>"
oQty ="<Br/>Qty: "

'add to the view label
oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale    & oQty    

Else
    MessageBox.Show("The selected object is not a drawing view", "iLogic")
End If

 

0 Likes
Message 8 of 21

JimmyDoe
Collaborator
Collaborator

Here is what the note should look like. I guess I didn't attach it to my first post Smiley Embarassed

0 Likes
Message 9 of 21

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi JimmyDoe ,

 

I think this will do it.

 

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

 

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim dScale As Double

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
	'get first view scale
	dScale = oSheet.DrawingViews.Item(1).Scale
	oViews = oSheet.DrawingViews
	For Each oView In oViews
		If dScale <> oView.Scale Then
		oView.ShowLabel = True
		oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
		oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
		oStringScale = "<Br/>SCALE <DrawingViewScale/>"
		oQty ="<Br/>Qty: "
		
		'add to the view label
		oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale  & oQty    

		Else
		oView.ShowLabel = False
		End If

	Next
Next

EESignature

0 Likes
Message 10 of 21

Curtis_Waguespack
Consultant
Consultant

Hi JimmyDoe,

 

Where do the values DWG.A1 and QTY: 4 come from?

 

Are those values that can be extracted from the model as well?

 

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

EESignature

0 Likes
Message 11 of 21

JimmyDoe
Collaborator
Collaborator

That is working exactly as it should, except that if the view scale is the same as the 'initial view scale' it removes the entire note. I would like just the 'SCALE' line to toggle on or off

I modified your code- below.  And now it is working exactly as I would like it. Thank you so much! 

 

 

SyntaxEditor Code Snippet

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim dScale As Double

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
    'get first view scale
    dScale = oSheet.DrawingViews.Item(1).Scale
    oViews = oSheet.DrawingViews
    For Each oView In oViews
        If dScale <> oView.Scale Then
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale  & oQty    

        Else
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        'oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oQty
  
        
        End If

    Next
Next

 

 

Message 12 of 21

JimmyDoe
Collaborator
Collaborator

Those are just manually filled out. On our assembly drawings the parts list have a comments column telling the guys what drawings the parts from each assembly are on. So, they asked if we could make it a two way street, which we do by adding that.

 

And we add the quantity to the note manually. We make 'dummy assemblies' to fill in the parts list on our drawings. But we add it manually to the note as a double check to make sure everything is accurate.

0 Likes
Message 13 of 21

Curtis_Waguespack
Consultant
Consultant

@JimmyDoe wrote:

Those are just manually filled out. On our assembly drawings the parts list have a comments column telling the guys what drawings the parts from each assembly are on. So, they asked if we could make it a two way street, which we do by adding that.

 

And we add the quantity to the note manually. We make 'dummy assemblies' to fill in the parts list on our drawings. But we add it manually to the note as a double check to make sure everything is accurate.


Hi JimmyDoe,

 

If those things are in the parts list they can likely be placed in the label automatically.

 

I just reused some code I found here to do just that. In this case it was to step though a drawing and find all of the views of flat patterns and turn on the labels, and pull the item number from the parts list  and place it in the view label. Below is an example iLogic rule.


The result being something like this:

Item in Drawing Labe;.png

 

 

 

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

 

Sub Main

'[ wrap in a transaction
'define application
Dim oApp As Application
oApp = ThisApplication

Call oApp.TransactionManager.StartTransaction(ThisDoc.Document, "MyTransAction")

'Set a reference To the drawing document.' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oSheets As Sheets
Dim Sheet As Inventor.Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

For Each oSheet In oDrawDoc.Sheets
	'For Each oSheet In oSheets
	oViews = oSheet.DrawingViews
	For Each oView In oViews
		If oView.IsFlatPatternView = True Then
			'Get the full filename Of the view model
			Dim oModelFileName As String
			oModelFileName = oView.ReferencedDocumentDescriptor.ReferencedDocument.FullFileName
			
			Dim oPartList As PartsList
			'try and get the parts list form the table of this sheet
			Try
				oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
			Catch 'on error try and search all sheets for first found parts list            
				'iterate trough each sheet
				Dim i As Long
				For i = 1 To oDrawDoc.Sheets.Count
					If oDrawDoc.Sheets.Item(i).PartsLists.Count > 0 Then Exit For
				Next    
				oPartList = oDrawDoc.Sheets.Item(i).PartsLists.Item(1)
			End Try
			
			' Iterate through the contents of the parts list.
			Dim j As Long
			For j = 1 To oPartList.PartsListRows.Count
				' Get the current row.
				Dim oRow As PartsListRow
				oRow = oPartList.PartsListRows.Item(j)
				'get filename of model in row
				Dim oRowFileName As String
				oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName
				'compare the filenames
				'Performs a text comparison, based on a case-insensitive text sort order
				'If strings equal returns 0
				If StrComp(oModelFileName, oRowFileName, CompareMethod.Text)=0 Then 
					'Get the value of Item from the Parts List
					'Row name needs to be case sensitive or use 1 for first 2 for second etc.
					oCell  = oPartList.PartsListRows.Item(j).Item("Item") 'Row name needs to be case sensitive or use 1 for first 2 for second etc.
					'get the value of text in cell
					Dim oItemValue As String
					oItemValue = oCell.Value
					
					'Show the view label
					oView.ShowLabel = True
					'format the text
					oStringItem = "<StyleOverride Underline='True' FontSize='0.4572'> ITEM " & oItemValue & " </StyleOverride>"
					oPartNumber = "<Br/><StyleOverride Underline='True' FontSize='0.4572'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property>.DXF</StyleOverride>"
					oStringScale = "<Br/><StyleOverride FontSize='0.3175'>SCALE <DrawingViewScale/></StyleOverride>"
					
					'add to the view label
					oView.Label.FormattedText =  oStringItem & oPartNumber & oStringScale
				End If  
			Next
		End If
	Next

Next 

oApp.TransactionManager.EndTransaction

End Sub

EESignature

0 Likes
Message 14 of 21

JimmyDoe
Collaborator
Collaborator

I appreciate that Curtis, but things could get a little messy taking it that far. We often have parts that are used in multiple drawings, so our note for quantities has to spell out how many parts there are total and how many in each assembly. And our drawings are all separate drawings with a single sheet each.

Message 15 of 21

JimmyDoe
Collaborator
Collaborator

So everything is working well with this code  except that I only would like it to add a note to the base views, not the projected views. I would also like it to not add a note under isometric views.

 

SyntaxEditor Code Snippet

'Controls whether or not to include the scale in the drawing view note, based on whether or not the view scale matches the 'initial view scale' 

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingView
Dim oView As DrawingView
Dim dScale As Double

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
    'get first view scale
    dScale = oSheet.DrawingViews.Item(1).Scale
    oViews = oSheet.DrawingViews
    For Each oView In oViews
        If dScale <> oView.Scale Then
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale  & oQty    

        Else
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        'oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oQty
  
        
        End If

    Next
Next

 

0 Likes
Message 16 of 21

Curtis_Waguespack
Consultant
Consultant

Hi Jimmy Doe,

 

You could use one of these, to look at only standard views, aka "Base Views", or filter out projected views, but I don't see how to filter outisometric views???

 

 

If oView.ViewType = 10501 Then 'kStandardDrawingViewType  ....

 

 

If oView.ViewType <> 10504 Then 'kProjectedDrawingViewType ....

 

 available enums:

 

kAssociativeDraftDrawingViewType 10506 View is an associative draft one.
kAuxiliaryDrawingViewType 10499 View is an auxiliary one.
kCustomDrawingViewType 10498 View with customized camera setting.
kDefaultDrawingViewType 10497 Specifies the default View. The more strongly typed value is returned in a query.
kDetailDrawingViewType 10502 View is a detail of a portion of the document contents.
kDraftDrawingViewType 10505 View is a draft one.
kOLEAttachmentDrawingViewType 10500 View is an OLE attachment.
kOverlayDrawingViewType 10507 View is an overlay one.
kProjectedDrawingViewType 10504 View is a projected one.
kSectionDrawingViewType 10503

View is a section.

 

kStandardDrawingViewType 10501 View with the camera set to one of the standard orthogonal views (Top, Iso, etc.).

 

 

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

EESignature

Message 17 of 21

Curtis_Waguespack
Consultant
Consultant

Hi JimmyDoe,

 

 

Edit: I think we posted at the same time, but this should make the need to find shaded views unnecessary.

 

I took another look at this and found that we can use the camera view associated to the drawing view to filter out iso views. Note there are some other view orientation types that you might need to filter for as well, see the list below. Example: kArbitraryViewOrientation

 

 

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

 

 

'Controls whether or not to include the scale in the drawing view note, based on whether or not the view scale matches the 'initial view scale' 

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim dScale As Double

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
    'get first view scale
    dScale = oSheet.DrawingViews.Item(1).Scale
    oViews = oSheet.DrawingViews
    For Each oView In oViews
		If oView.ViewType  = DrawingViewTypeEnum.kStandardDrawingViewType Then
			'sip iso views
			If oView.Camera.ViewOrientationType <> ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation Or _
				oView.Camera.ViewOrientationType <> ViewOrientationTypeEnum.kIsoBottomRightViewOrientation Or _
				oView.Camera.ViewOrientationType <> ViewOrientationTypeEnum.kIsoTopLeftViewOrientation Or _
				oView.Camera.ViewOrientationType <> ViewOrientationTypeEnum.kIsoTopRightViewOrientation Then
			Else
				Goto NextIteration
			End If	
		Else
			Goto NextIteration
		End If

        If dScale <> oView.Scale Then
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale  & oQty    

        Else
        oView.ShowLabel = True
        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"
        'oStringScale = "<Br/>SCALE <DrawingViewScale/>"
        oQty ="<Br/>Qty: "
        
        'add to the view label
        oView.Label.FormattedText =  oPartNumber & oStockNumber & oQty
  
        
        End If
		NextIteration:
    Next
Next

 

 

ViewOrientationTypeEnum Enumerator

Description

View Orientation Type.

Methods

Name Value Description
kArbitraryViewOrientation 10763 Arbitrary View.
kBackViewOrientation 10756 Back View.
kBottomViewOrientation 10757 Bottom View.
kCurrentViewOrientation 10765 Current View.
kDefaultViewOrientation 10753 Specifies the default setting to use. Inquiry methods/properties always return the more strongly typed values.
kFlatBacksidePivot180ViewOrientation 10773 Sheet metal flat pattern backside pivot 180 degrees.
kFlatBacksidePivotLeftViewOrientation 10772 Sheet metal flat pattern backside pivot left.
kFlatBacksidePivotRightViewOrientation 10771 Sheet metal flat pattern backside pivot right.
kFlatBacksideViewOrientation 10770 Sheet metal flat pattern backside.
kFlatPivot180ViewOrientation 10769 Sheet metal flat pattern pivot 180 degrees.
kFlatPivotLeftViewOrientation 10768 Sheet metal flat pattern pivot left.
kFlatPivotRightViewOrientation 10767 Sheet metal flat pattern pivot right.
kFrontViewOrientation 10764 Front View.
kIsoBottomLeftViewOrientation 10762 Isometric -- Bottom Left View.
kIsoBottomRightViewOrientation 10761 Isometric -- Bottom Right View.
kIsoTopLeftViewOrientation 10760 Isometric -- Top Left View.
kIsoTopRightViewOrientation 10759 Isometric -- Top Right View.
kLeftViewOrientation 10758 Left View.
kRightViewOrientation 10755 Right View.
kSavedCameraViewOrientation 10766 Saved camera View.
kTopViewOrientation 10754 Top View.

 

 

 

 

EESignature

0 Likes
Message 18 of 21

JimmyDoe
Collaborator
Collaborator

Thank you, Curtis! I was able to tweak my code to only show notes on my base views. Now I might be asking too much, but is there anyway iLogic can recognize that a view is shaded and exclude it from my rule? This would take care of not being able to filter out isometric views, because they are they only ones we shade.

0 Likes
Message 19 of 21

JimmyDoe
Collaborator
Collaborator

Hi Curtis,

 

Sorry it's been so long, this was put on the back burner for a while.

 

Anyway, near the very bottom of the code below, I am trying to tell it that if the drawing view 'type' is an orthagonal view and the 'style' is shaded then I want no view label shown. It does not do that, unfortunately. Can you see where I went astray?

 

 

'Controls whether or not to include the scale in the drawing view note, based on whether or not the view scale matches the 'initial view scale'

 

Dim oSheets As Sheets

Dim oSheet As Sheet

Dim oViews As DrawingViews

Dim oView As DrawingView

Dim dScale As Double

 

oSheets = ThisDoc.Document.Sheets

 

For Each oSheet In oSheets

    'get first view scale

    dScale = oSheet.DrawingViews.Item(1).Scale

    oViews = oSheet.DrawingViews

    For Each oView In oViews

        If dScale <> oView.Scale And oView.ViewType= 10501 Then

        oView.ShowLabel = True

        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"

        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"

        oStringScale = "<Br/>SCALE <DrawingViewScale/>"

        oQty ="<Br/>Qty: "

       

        'add to the view label

        oView.Label.FormattedText =  oPartNumber & oStockNumber & oStringScale  & oQty  

       

 

 

 

        Else If dScale = oView.Scale And oView.ViewType=10501 Then

        oView.ShowLabel = True

        oPartNumber = "<StyleOverride Bold='True' Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"

        oStockNumber = "<Br/><StyleOverride Bold='false' Underline='false'><Property Document='model' PropertySet='Design Tracking Properties' Property='Stock Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>STOCK NUMBER</Property></StyleOverride>"

        'oStringScale = "<Br/>SCALE <DrawingViewScale/>"

        oQty ="<Br/>Qty: "

       

        'add to the view label

        oView.Label.FormattedText =  oPartNumber & oStockNumber & oQty

       

       

       

       

        Else If oView.ViewType= 10502 Then

        oView.ShowLabel = True

        oStringView="DETAIL <DrawingViewName/>"

        oStringScale = "<Br/>SCALE <DrawingViewScale/>"

              

        'add to the view label

        oView.Label.FormattedText =  oStringView & oStringScale

       

 

 

 

        Else If oView.ViewType=10503 Then

        oView.ShowLabel = True

        oStringView = "SECTION <DrawingViewName/>-<DrawingViewName/>"

        oStringScale = "<Br/>SCALE <DrawingViewScale/>"

       

        'add to the view label

        oView.Label.FormattedText =  oStringView & oStringScale

       

        Else If oView.ViewType=10501 And oView.ViewStyle=32259 Then

        oView.ShowLabel = False

       

       

        Else oView.ShowLabel = False

 

       

        End If

       

 

    Next

Next

0 Likes
Message 20 of 21

Curtis_Waguespack
Consultant
Consultant

Hi JimmyDoe,

 

At the top of your If statement it's checking for view scale and type, and turning on the label If the condition is found to be true, then at the end it is checking the type and style.

 

So it never gets to the type and style checks, because it finds one of the scale and type conditions to be true. Basically your if/then is mixing two conditional checks.

 

I would break this into 2 if/then's:

  1. one that checks scale & type (and then sets the label text, but does not turn the label on)
  2. and then a second that checks type and style (and turns the label on / off)

Or nest the second if/then within the 1st.

 

Let me know if that's unclear and I'll try and post back an example.

 

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

EESignature

0 Likes