Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Prompted Entry into Symbol Array Drawings

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
A.Acheson
622 Views, 4 Replies

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

Prompted Entry into Symbol Array Drawings

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
Labels (1)
4 REPLIES 4
Message 2 of 5
Michael.Navara
in reply to: A.Acheson

Michael.Navara
Advisor
Advisor

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

0 Likes

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

Message 3 of 5
A.Acheson
in reply to: Michael.Navara

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

@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
Message 4 of 5
Michael.Navara
in reply to: A.Acheson

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))

 

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
in reply to: Michael.Navara

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

@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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report