Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

[Frage] Label Style with VBS Function [Gelöst]

Schlagworte:
  • Label style VBS function

Hello Everyone.
I’m trying to create a Label Style in which, according to the "material" Allplan attribute, a different "provider" value appears. The list is very extensive, exceeds 250 characters so with internal formulas of Allplan I don’t have enough.

For example:

if material = concrete then the provider must be = A
if material = wood then the provider must be = B
if material = steel then the provider must be = C

Etc… (the list can be very long)

I am trying to create a function in VBS but something must be done wrong because I don’t get any results.

I have some objects with different values in material attribute. For example example:
Concrete, wood, steel…

(see picture 1)

I edit the “functions.vbs” file located in ..\Std\vbs folder, and add this information:

Function provider(Name)

If Name="concrete" Then Provider = "A"
If Name="wood" Then Provider = "B"
If Name="steel" Then Provider = "C"

Else provider = "No provider"

End If
End Function

(see picture 2)

Finally, inside Allplan, I create a new Label Style with the formula:

provider(@508@)

(where @508@ is “Material Allplan attribute)

(see picture 3)

And stored it

When I apply this Label Style to a object, no text appear

Any suggestions? I could not find where the error is...

Thanks!

Antolí.

Anhänge (3)

Typ: image/jpeg
102-mal heruntergeladen
Größe: 79,48 KiB
Typ: image/jpeg
162-mal heruntergeladen
Größe: 96,72 KiB
Typ: image/jpeg
96-mal heruntergeladen
Größe: 111,78 KiB

Lösung anzeigen Lösung verbergen

Hi Antoli!

I think your VBS syntax is wrong - try this instead:

Function provider(Name)

If Name="concrete" Then
	provider = "A"
ElseIf Name="wood" Then
	provider = "B"
ElseIf Name="steel" Then
	provider = "C"
Else
	provider = "No provider"
End If

End Function

Un saludo,
Stefan

GEA Arquitectos S.L.P.
Calle Gerardo Diego 6A | 41013 Sevilla | Spain

Hi Antoli!

I think your VBS syntax is wrong - try this instead:

Function provider(Name)

If Name="concrete" Then
	provider = "A"
ElseIf Name="wood" Then
	provider = "B"
ElseIf Name="steel" Then
	provider = "C"
Else
	provider = "No provider"
End If

End Function

Un saludo,
Stefan

GEA Arquitectos S.L.P.
Calle Gerardo Diego 6A | 41013 Sevilla | Spain

OK! Thank you very much Stefan!
Yes, it was indeed a syntax error (in VBS the lines do matter )
I've also seen that there are a relationship with the language selected in Allmenu. Depending on the selected language, the Label Style may or not appear correctly.

Thanks for your kind instructions!

Antolí.

You are welcome!

My problem with the VBS is, that the same script runs fine on most Allplan-PCs in our network, but on some it does not execute at all.
I tried shutting down Firewall and Antivirus, even saved the script locally and changed the Registry-Entry, but it doesn't help:
On some PCs my formula returns a combined string value, on others just an empty line.

If someone has similar problems and found a solution I would love to know.

GEA Arquitectos S.L.P.
Calle Gerardo Diego 6A | 41013 Sevilla | Spain

Hi Stefan, some thoughts out loud:
It could be something from the security policies of domain users. For what you say, I understand that you have one or more Windows servers and the users are Domain users.
Try to check the Group Policy of Active Directory infrastructure
Try to in the same computer that the vbs is not executed correctly, start session with another different user account.
Are the users Administrators of the PC?...

I wish you luck!

Antolí.