put a drawing view name to prompted entry symbol

put a drawing view name to prompted entry symbol

Anonymous
Not applicable
1,411 Views
8 Replies
Message 1 of 9

put a drawing view name to prompted entry symbol

Anonymous
Not applicable

Hi!

 

I use a CommandManager.Pick command to select my drawing view and i want to put information of this view to a prompted entry in my sketched symbols, i have many same symbols in my page and i want to put a different description for each symblos but with a same prompted entry name, ex.: <NAME>

 

Thanks for your help!

0 Likes
1,412 Views
8 Replies
Replies (8)
Message 2 of 9

Stakin
Collaborator
Collaborator

Please Upload a sample pic,it is not Very Clear

0 Likes
Message 3 of 9

Anonymous
Not applicable

Capture1.PNGCapture2.PNG

0 Likes
Message 4 of 9

Anonymous
Not applicable

Does anyone have code for a sketch symbol to be entered/created under a view once it has been created on a sheet.

 

I have a custom view label since the standard inventor design cannot be modified.

 

Cheers,

0 Likes
Message 5 of 9

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

I wrote an iLogic code as below. Hope it helps. Please refer to the attached fig on how I defined the sketched symbol.

 

 
    Dim doc as DrawingDocument
    doc = ThisApplication.ActiveDocument 
	
		
	Dim oObj As Object  	
	oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter,"Select a view:")
	
	
	If oObj Is Nothing Then
	
	Else
	     Dim viewName As String = oObj.Name
		 
		 Dim oNewResultText
		 oNewResultText = viewName + "other description"
		 		 
		 Dim oPromptText  As TextBox
		 
		 
		 ' assume the name of sketched symbol definition is
		 ' "MySymbol"
		 Dim oSSD As SketchedSymbolDefinition
		 oSSD = doc.SketchedSymbolDefinitions("MySymbol")
		 
		 
		 '' search the prompt textbox in definition
		 Dim oEachText As TextBox
		 Dim I 
		 For I = 1 To oSSD.Sketch.TextBoxes.Count
          oEachText = oSSD.Sketch.TextBoxes(I)
          If (oEachText.Text = "MY_PROMPT") Then
            ' found the prompt text we want to copy
              oPromptText = oEachText
            Exit For
          End If
        Next I
		
		'change the result text of the SketchedSymbol
		Dim oSS As SketchedSymbol
		For Each oSS In doc.ActiveSheet.SketchedSymbols 
		   If oSS.Definition.Name = "MySymbol" Then
		      MsgBox(oNewResultText)
		       oSS.SetPromptResultText(oEachText,oNewResultText)
		   End If
		Next
    
	End If
 

 

Message 6 of 9

Anonymous
Not applicable

 Thanks for your time Xiaodong Liang

 work great 🙂

0 Likes
Message 7 of 9

Anonymous
Not applicable

and if i want to change only the selected view sketched symblos and not all in the sheet?

0 Likes
Message 8 of 9

Anonymous
Not applicable

my test, but dont work 😞

 

Parameter.Quiet = True
Dim doc = ThisApplication.ActiveDocument
Dim entity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view.")

modelName = IO.Path.GetFileName(ActiveSheet.View(entity.Name).ModelDocument.FullFileName)
page = Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 6)
iProperties.Value("Custom", "dossier du part") = (Left(modelName,11))
iProperties.Value("Custom", "dossier du projet")= (Right(ThisDoc.Path,11))
DETAIL1 = InputBox("NUMÉRO DU TITRE?", "TITRE", "Default Entry")

Dim viewName As String = entity.Name
Dim oNewResultText2
oNewResultText2 = ActiveSheet.View(entity.Name).ScaleString
Dim oPromptText As TextBox
Dim oSSD As SketchedSymbolDefinition
Dim oSS As SketchedSymbol
oSSD = doc.SketchedSymbolDefinitions("TITRE1 DETAIL")
Dim oEachText2 As TextBox
oEachText2 = oSSD.Sketch.TextBoxes
If (oEachText2.Text = "test") Then
oSS.SetPromptResultText(oEachText2,oNewResultText2)
End If

0 Likes
Message 9 of 9

Anonymous
Not applicable
Tried the code also, it works nice! Could this also be run with the same yield, but also reading a view's Page Number? Also, is there a way to pick what bubble this script could be applied to? I've a drawing set with several page refs, so adding one page takes up time to retype all 30+ field bubbles.
0 Likes