Jump to content

fix Nested If-Then-Statement


jntm226

Recommended Posts

hello everyone.

 

Probably I found a bug with the VBScript. I was creating and experimenting a lot with the VBScript function if-then-elseif-else statement and I found something that before saving my drawing was working, but know that I was checking again simply stop working.

 

 

large?v=1.0&px=999

 
large?v=1.0&px=999


I was linking multiple functions to the function name "NAME_BY_OBJECT" which generates a different name per each different object. In images 1 and 2, everything is correct...

 

... but something weird happens with I add the object type "Hanger":

 
large?v=1.0&px=999


large?v=1.0&px=999

 

... again everything works correct, but just with hangers, but I was checking the cable trays and cable trays fitting this happens:

 
large?v=1.0&px=999

large?v=1.0&px=999

 

 

I do not what happens here.

 Then:

1) am I doing something bad?

2)if yes, how can I fix this?

3) if not, What Is wrong, and what alternatives exist?

 

PD: attached files


before:
 

 
If "[ObjectType]" = "Cable Tray" Then
	RESULT = "[NAME_CABLE_TRAY]"

ElseIf "[ObjectType]" = "Cable Tray Fitting" Then
	RESULT = "[NAME_CABLE_TRAY_FITTING]"

Else
	RESULT = "NA"

End If
 


 
after:

 

 

If "[ObjectType]" = "Cable Tray" Then
	RESULT = "[NAME_CABLE_TRAY]"

ElseIf "[ObjectType]" = "Cable Tray Fitting" Then
	RESULT = "[NAME_CABLE_TRAY_FITTING]"

ElseIf "[ObjectType]" = "Hanger" Then
	RESULT = "[NAME_HANGER]"

Else
	RESULT = "NA"

End If
 




 

property bug with hanger added.dwg property bug.dwg

Edited by jntm226
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...