Parameter is Incorrect?

Parameter is Incorrect?

Anonymous
Not applicable
903 Views
4 Replies
Message 1 of 5

Parameter is Incorrect?

Anonymous
Not applicable

Hi all, trying to do some coding, wanting to add a symbol to a sheet using some VB.NET code.

 

I can create the symbol just fine, but when I try to place the symbol on the sheet at (0,0) I get the error "The parameter is incorrect".

 

Google has failed me, any suggestions?

ParameterisIncorrect.PNG

 

0 Likes
Accepted solutions (1)
904 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, just to discard possibilities. Personally I have had problems in the "promtstrings", for example if I need 4 entries I must specify the number 3, because the array starts counting from zero. You can take the test if you put the promtstrings (0) and it will return a value. I clarify this because if you need 5 tickets and you put the number 5 you are actually specifying 6 entries. I hope you can solve your problem.


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 5

Anonymous
Not applicable

@Sergio.D.Suárez 

Thanks for spending the time to respond. I'm still quite new to programming and what you described, I did not understand. Could you explain again?

0 Likes
Message 4 of 5

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Here is an example in ilogic (which is based on VB.net I think).
There are four entries requested. in the code they are marked 3 because it counts from zero.
He does not know the time that I have lost for such a tiny detail !
I attached the file to make it easier to understand.
Execute and observe rule 1.
I hope you can solve your problem. regards

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet

Dim oSymDef As SketchedSymbolDefinition = oDoc.SketchedSymbolDefinitions.Item("Label - Door/Window")
Dim sPromptStrings(3) As String 
sPromptStrings(0) = "Value A"
sPromptStrings(1) = "Value B"
sPromptStrings(2) = "Value C"
sPromptStrings(3) = "Value D"

Dim oPosition As Point2d =  ThisApplication.TransientGeometry.CreatePoint2d(10,15)

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

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 5 of 5

Anonymous
Not applicable

Aah. I understand what you were explaining. The code that I'm trying to duplicate is from an example inside the Inventor API help file. After looking at your last post, I figured out what I was missing:

Capture.PNG

 

I had failed to put the "(0)" bits after my promptstring definition.

 

Since I was duplicating the example, I don't understand why Promptstring is even used. Tooltips and definitions inside Visual Studio are not really helping. Could you explain?

0 Likes