Prompted Entry into Symbol Array Drawings

Prompted Entry into Symbol Array Drawings

A.Acheson
Mentor Mentor
789 Views
4 Replies
Message 1 of 5

Prompted Entry into Symbol Array Drawings

A.Acheson
Mentor
Mentor

Hello,

 

Just wondering is it possible to place  prompted entry into symbol1 prompted entry(), then symbol2prompted entry()  into an array of symbols in order to utilize the same code. 

 

The link shown here uses one prompted entry array for one symbol. 
https://forums.autodesk.com/t5/inventor-customization/ilogic-place-sketch-symbol-with-prompted-entry...

 

I was able to add symbols using an array but failed to add more than one prompted entry array  or indeed unable to place another set of prompted entry into an if statement to choose which symbol each set was added to. There was an error on  this line

Dim sPromptStrings(4) As String

Saying unavailable due to  protection. 

Looking to add 5 symbols like this and having 5 rules is a lot of maintenance.

Any help greatly appreciated.

 

I can post the actually code I used tomorrow. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Accepted solutions (1)
790 Views
4 Replies
Replies (4)
Message 2 of 5

Michael.Navara
Advisor
Advisor

You want to use one code base for different sketched symbols with different number of prompts?

0 Likes
Message 3 of 5

A.Acheson
Mentor
Mentor

@Michael.Navara 

Thankyou for your response, correct and different content.

A Sample of what I wanted to happen .

symbol array.......

 

IF Symbol = “A”

Dim sPromptStrings(0) As String
ElseIf Symbol = “B”

Dim sPromptStrings(1) As String

End If

 

Dim oSymbol As SketchedSymbol: oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition, , ,sPromptStrings)

 

The error comes when both prompted strings Dim are entered.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 4 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

You can't declare varible twice in one code block. See the following example

'Prepare
Dim Symbol = "B"


Dim sPromptStrings As String()
If Symbol = "A"
	sPromptStrings = {"A"}
ElseIf Symbol = "B"
	sPromptStrings = {"B1", "B2" }
End If

'Debug
Logger.Info(String.Join(vbCrLf,sPromptStrings))

 

Message 5 of 5

A.Acheson
Mentor
Mentor

@Michael.Navara 

Thankyou for your response. This worked great. The sample below is the multiple PromptStrings working on seperate symbols. 

 

 

'Prepare
Dim SymbolList  As New ArrayList
		SymbolList .Add("A")
		SymbolList .Add("B")
		

		oArray1 = InputListBox("Select one:",SymbolList, "", "iLogic", "Enter Default Answer Here")
 
Dim Symbol As String
For Each Symbol In SymbolList


 
		Dim sPromptStrings As String()
		If Symbol = "A"
			sPromptStrings = {"This is Symbol A Message"}
		ElseIf Symbol = "B"
			sPromptStrings = {"This is Symbol B Message-1", "This is Symbol B Message-2" }
		End If

		'Debug
		Logger.Info(String.Join(vbCrLf, sPromptStrings))

		MessageBox.Show("Symbol: "& Symbol, "Title")
		oArray2 = InputListBox("Select one:",sPromptStrings, "", "iLogic", "Enter Default Answer Here")
Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes