Neep help. InputRadioButton is mocking me

Neep help. InputRadioButton is mocking me

Anonymous
Not applicable
731 Views
5 Replies
Message 1 of 6

Neep help. InputRadioButton is mocking me

Anonymous
Not applicable

 

Can someone take a look at the code below and tell me what I'm doing wrong? I keep getting the error message : "ClickA is masking a variable in a global bloc" or some such. It's in french ("La variable 'ClickA' masque une variable dans un bloc englobant").

 

I figure it means that a variable is being declared twice, but I put it in a "IF" loop, so it should not see the second one, right?

 

Thank you.

 

SyntaxEditor Code Snippet

' --- Choisis la methode' Face - Face' Face - Point' Point - Point
Dim Choix1 as Boolean
Dim Choix2 as Boolean
Dim DistPoints As Double
Dim DistPoints2 As Double
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
'--- First selection Choix1 = InputRadioBox("Choisis le type de selection : ", "Face", "Point", True, Title := "Premiere Selection d'entite" If Choix1 = True Dim ClickA As Face ClickA = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Clique sur la Face 1 : ") Else Dim ClickA As Point ClickA = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Clique sur le Point 1 : ") End If
'--- Second selection Choix2 = InputRadioBox("Choisis le type de selection : ", "Face", "Point", True, Title := "Deuxieme Selection d'entite") If Choix2 = True Dim ClickB As Face ClickB = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Clique sur la Face 2 : ") Else Dim ClickB As Point ClickB = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Clique sur le Point 2 : ") End If

'--- Measure distance DistPoints = ThisApplication.MeasureTools.GetMinimumDistance(ClickA, ClickB) DistPoints2 = DistPoints / 2.54 MessageBox.Show("Longueur = " & DistPoints2 & " pouces", "Title")

 

 

 

0 Likes
Accepted solutions (1)
732 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Move Dim ClickA as Face out of the IF Then block
Message 3 of 6

Anonymous
Not applicable

I was hoping I wouldn't need to do that. Darn it. 

 

Thank you

0 Likes
Message 4 of 6

Anonymous
Not applicable
Accepted solution

The getminimumdistance method accepts objects for entity one and two. try this

 

' --- Choisis la methode' Face - Face' Face - Point' Point - Point
Dim Choix1 as Boolean
Dim Choix2 as Boolean
Dim DistPoints As Double
Dim DistPoints2 As Double
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim ClickA as object
Dim ClickB as object

'--- First selection
Choix1 = InputRadioBox("Choisis le type de selection : ", "Face", "Point", True, Title := "Premiere Selection d'entite"
If Choix1 = True

ClickA = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Clique sur la Face 1 : ")
Else

ClickA = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Clique sur le Point 1 : ")
End If

'--- Second selection
Choix2 = InputRadioBox("Choisis le type de selection : ", "Face", "Point", True, Title := "Deuxieme Selection d'entite")
If Choix2 = True

ClickB = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Clique sur la Face 2 : ")
Else

ClickB = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Clique sur le Point 2 : ")
End If

'--- Measure distance
DistPoints = ThisApplication.MeasureTools.GetMinimumDistance(ClickA, ClickB)
DistPoints2 = DistPoints / 2.54
MessageBox.Show("Longueur =   " & DistPoints2 & " pouces", "Title")

Message 5 of 6

Anonymous
Not applicable

Dude! You Rock!

 

iLogic needs a single source of reference, like a book or complete website. Help files are nice, but hardly cover 25% of what's possible with the code. 

 

Kudos for days!

0 Likes
Message 6 of 6

Anonymous
Not applicable

I'm glad I could help you. There have been a lot of folks on here that have helped me.

0 Likes