Inventor Customization

Inventor Customization

Reply
Valued Contributor
dunc1n
Posts: 56
Registered: ‎06-15-2010
Message 1 of 14 (1,952 Views)

Creating Intelligent sketched symbols

1952 Views, 13 Replies
02-01-2012 05:44 AM

Hi Folks, I got another question for you all.

 

I am currently working on creating new symbols. Now I want to keep the look of the symbol (see attached) but I want all the text to be automated as the text is currently "prompted entry".

Now when I go into the edit the text within the symbol sketch, I need the "view label properties" from the drop down menu but its not there!?!?! Is there a way that I can get the "view label properties" into the drop down menu??? What I am after is to attach this symbol to a view and the symbol will automatically show the name of the view and the scale.

 

OR........ If there is any way that I can get default view label to look like my symbol???? This would probably be the better idea but Im pretty sure you cannot edit the look of the view label symbol.......... but hopefully Im wrong with this???

 

Thanks again folks

 

Dunc1n

Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 2 of 14 (1,829 Views)

Re: Creating Intelligent sketched symbols

06-05-2012 03:59 AM in reply to: dunc1n

Do you know to make your symbol now? I want to make the similar symbole with scale view in?

*Expert Elite*
Curtis_Waguespack
Posts: 3,002
Registered: ‎03-08-2006
Message 3 of 14 (1,768 Views)

Ilogic drawing view label scale and name

06-20-2012 09:40 AM in reply to: sergelachance

Hi sergelachance,

 

Here is what I've come up with based on jdkriek's great example at this thread:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/iLogic-Controlled-Sketch-Symbol/td-p/3...

 

The rule first looks for existing view label symbols and removes them, then replaces them on all of the sheets. This rule could use some refinement, so if you improve upon it please post back some examples.

 

Also, I've attached an example drawing file that you can use to see how this is set up.

 

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


 

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
Dim oSheets As Sheets
oSheets = oDoc.Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oSymbol As SketchedSymbol
Dim oSymbols As SketchedSymbols

'iterate through all of the sheets
For Each oSheet In oSheets
    'remove existing sketched symbols named View Label
    For Each oSymbol  In oSheet.SketchedSymbols
    If oSymbol.Definition.Name = "View_Label" Then
    oSymbol.Delete
    Else
    End if
    Next
    
'set sheet active    
oSheet.Activate
'set a refernce to the drawing views collection
oViews = oDoc.ActiveSheet.DrawingViews
    ' Iterate through all of the views
    For Each oView In oViews
    'This places a sketched symbol with the name "View_Label"
    Dim oSymDef As SketchedSymbolDefinition
    'defind the sketch symbol to be inserted
    oSymDef = oDoc.SketchedSymbolDefinitions.Item("View_Label")
    
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String
    sPromptStrings(0) = "SCALE " & oView.Scale 'set to view scale
    sPromptStrings(1) = oView.Name 'set to view name
    
    'set the position for the sketched symbol to be inserted
    ' and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 2 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
    Next    
Next

'activate sheet1
oDoc.Sheets.Item(1).Activate

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 4 of 14 (1,762 Views)

Re: Ilogic drawing view label scale and name

06-20-2012 09:49 AM in reply to: Curtis_Waguespack

Thanks Curtis you are the king :smileyhappy:


Curtis_Waguespack wrote:

Hi sergelachance,

 

Here is what I've come up with based on jdkriek's great example at this thread:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/iLogic-Controlled-Sketch-Symbol/td-p/3...

 

The rule first looks for existing view label symbols and removes them, then replaces them on all of the sheets. This rule could use some refinement, so if you improve upon it please post back some examples.

 

Also, I've attached an example drawing file that you can use to see how this is set up.

 

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


 

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
Dim oSheets As Sheets
oSheets = oDoc.Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oSymbol As SketchedSymbol
Dim oSymbols As SketchedSymbols

'iterate through all of the sheets
For Each oSheet In oSheets
    'remove existing sketched symbols named View Label
    For Each oSymbol  In oSheet.SketchedSymbols
    If oSymbol.Definition.Name = "View_Label" Then
    oSymbol.Delete
    Else
    End if
    Next
    
'set sheet active    
oSheet.Activate
'set a refernce to the drawing views collection
oViews = oDoc.ActiveSheet.DrawingViews
    ' Iterate through all of the views
    For Each oView In oViews
    'This places a sketched symbol with the name "View_Label"
    Dim oSymDef As SketchedSymbolDefinition
    'defind the sketch symbol to be inserted
    oSymDef = oDoc.SketchedSymbolDefinitions.Item("View_Label")
    
    'set a string array with values for the prompted entries found in the symbol
    Dim sPromptStrings(1) As String
    sPromptStrings(0) = "SCALE " & oView.Scale 'set to view scale
    sPromptStrings(1) = oView.Name 'set to view name
    
    'set the position for the sketched symbol to be inserted
    ' and spaced off of the selected view center
    Dim oPosition As Point2d: oPosition = oView.Center
    oPosition.y = oPosition.y - (oView.Height / 2 + 0.6)
    'insert the sketched symbol and set the prompted entries
    oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings)
    Next    
Next

'activate sheet1
oDoc.Sheets.Item(1).Activate

 


 

Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 5 of 14 (1,708 Views)

Re: Ilogic drawing view label scale and name

07-05-2012 06:08 AM in reply to: sergelachance

AND IF I WANT MY SCALE IN INCHES :smileywink: DO YOU HAVE A SOLUTION AGAIN :smileyhappy:

Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 6 of 14 (1,615 Views)

Re: Ilogic drawing view label scale and name

10-01-2012 10:04 AM in reply to: sergelachance

i dont want to insert and delete automaticaly the sketched symbol, because too many style in each sheet, i just want to update de oview name et oview scale of each symbols  in each sheets and it's possible to put the scale in feets? ex.:1/4"=1'-0"

 

Thanks for any help

ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 7 of 14 (1,562 Views)

Re: Ilogic drawing view label scale and name

10-14-2012 08:13 PM in reply to: sergelachance

Hi,

 

I may not understand your question correctly. It looks you want to update the value of the prompt string (in inch) in a sketched symbol. If yes, I think you could just convert the scale to inch by UnitsOfMeasure.GetPreciseStringFromValue and set the argument. e.g. on the basis of the code above provied by Curtis.

 

'set to view scale

sPromptStrings(0) = "SCALE " & UnitsOfMeasure.GetPreciseStringFromValue(oView.Scale,kInchLengthUnits)

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 8 of 14 (1,514 Views)

Re: Ilogic drawing view label scale and name

11-05-2012 03:28 AM in reply to: xiaodong.liang

Thanks for your reply xiaodong but dont work :smileysad:

ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 9 of 14 (1,461 Views)

Re: Ilogic drawing view label scale and name

11-14-2012 06:53 PM in reply to: sergelachance

Hi,

 

Could you elaborate what is your exact problem? any code and snapshot?



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
sergelachance
Posts: 182
Registered: ‎04-30-2012
Message 10 of 14 (1,440 Views)

Re: Ilogic drawing view label scale and name

11-20-2012 05:54 AM in reply to: xiaodong.liang

IT'S NECESSARY TO DELETE AND REPLACE ALL SKETCHED SYMBOILS?

 

FIRST PIC = BEFORE CAPTURE SCREEN!

SECOND PIC = BEFORE RULE

THIRD PIC =  WITH YOUR RULE AND MY ERROR CODE

 

THANKS AGAIN FOR YOUR HELP :smileyhappy:

 

 

SCALE.PNGSCALE BEFORE.PNGSCALE AFTER WITH ERROR.PNG

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.