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
Do you know to make your symbol now? I want to make the similar symbole with scale view in?
Hi sergelachance,
Here is what I've come up with based on jdkriek's great example at this thread:
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
Thanks Curtis you are the king 🙂
@Curtis_Waguespack wrote:Hi sergelachance,
Here is what I've come up with based on jdkriek's great example at this thread:
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
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
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)
Hi,
Could you elaborate what is your exact problem? any code and snapshot?
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 🙂
Hi,
Sorry, I was very busy on DevDays.
I struggled to reproduce your problem, however it is hard without reproducible sample. Could you provide a small source code? In addition, have you debugged to check the error message is due to the line of GetPreciseStringFromValue. Or could you create a smallest test function to run UnitsOfMeasure.GetPreciseStringFromValue(oView.Scale,kInchLengthUnits) only to see if it works?
THE FILE!
SORRY REALLY REALLY BUSY TOO 🙂
IT'S REALLY NECESSARY TO DELETE AND INSERT THE TITLEBLOCK???
THANKS AGAIN FOR YOUR HELP 🙂
Hi,
You should change like below. It works for me under 2013 @ win 7 -32bit.
sPromptStrings(0) = "SCALE " & oDoc.UnitsOfMeasure.GetPreciseStringFromValue(oView.Scale,UnitsTypeEnum.kInchLengthUnits)
But it adds an "In" at the end and looks strange.
Be aware, the scale value itself is UNIT-LESS. If you write like A:B, it is fine. You can convert A and B seperately.
If it is only a ratio value, there is no point to have a conversion.
Regards
Peter
the solution who work for me is
sPromptStrings(0) = "SCALE " & oView.ScaleString 'set to view scale
I have been looking for something like this, putting this view label w/ 1/4" = 1'-0". Can you post the code you used to achieve this, thank you!
Hi @xiaodong_liang,
I stumbled upon this thread while trying to set up an inventor template to look something like our existing autocad template. I have been able to successfully get the code to work, but I would like to add in a couple user defined field. When I add those in the ilogic code breaks. Can you take a look at the attached and see if there is a solution here for me?
The picture below is the working view-label and the old one, who's layout I would like to use in the new view-label:
many thanks,
Andrew
Hi Andrew,
Without your code and a sample drawing with the sketched symbol in question, or more information it's hard to precisely diagnose the issue.
My guess is that you did not revise the code for adding the additional prompted entry string as is required for the change to the symbol definition.
For insterting/adding sketched symbols, the code my be supplied with promptstrings as corresponds to the number of prompted entry fields.
Searching sPromptStrings should find you more examples of such a scenario.
Hi Justin,
I've attached the drawing file and the code is pasted below. My understanding of ilogic is "extremely limited" - read: little to none.
FYI - This code was pasted earlier in the thread, I just copied it into my drawing along with the sketch symbol which I've modified to look more like our existing view label title block from Autocad.
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) = "" & oView.ScaleString '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 + 2) '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
@MechMachineMan - I was able to add in the user prompted fields without the code creating an error, however when the rule runs now it deletes the existing text and replaces it with the default.
This is how I got it to recognize the other user prompted fields. Would the solution here be something to do with the beginning of the code where it clears all the existing blocks? That seems a pretty obvious place to start with...
SyntaxEditor Code Snippet
Dim sPromptStrings(4) As String sPromptStrings(0) = "" & oView.ScaleString 'set to view scale sPromptStrings(1) = oView.Name 'set to view name sPromptStrings(2) = "DESCRIPTION" sPromptStrings(3) = "QTY" sPromptStrings(4) = "NOTE"
SyntaxEditor Code Snippet
'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
Nice Job. I can't believe Autodesk doesn't have this along with other drafting symbols incorporated