VBScript and Mapping Function on labelling

VBScript and Mapping Function on labelling

Anonymous
Not applicable
1,638 Views
4 Replies
Message 1 of 5

VBScript and Mapping Function on labelling

Anonymous
Not applicable

hi all,

I can not find any information on "VBScript"  (and also "Mapping") function from the label form.
I would need to create a conditional statement, assuming that it is possible,
in which the conditional is, for example, the presence or absence of the %UserAttr4.
does anyone have any links to which I can find information or some input advice to start?
 
Thanks in advance
Marco
0 Likes
Accepted solutions (1)
1,639 Views
4 Replies
Replies (4)
Message 2 of 5

sorin.brinzaru
Autodesk
Autodesk
Accepted solution

Hello @Anonymous,

 

If you are referring to the Label content manager then you can write custom VBScript code (will show up as [VBScript] in the default view).

First you need to switch to editing view by pressing the q button. Then you can enter VBScript code using %%script() . Just make sure that you use at the end appendString(text) if you want your text to appear in the label content.

Please take the below sample as an example:

 

%Position 
%%script(var = "%UserAttr4"
If Len(var) > 0 Then 
 display = "present"
else
 display = "absent"
End If
appendString(display))

Hope it helps,

Sorin

Message 3 of 5

SanjoyNath
Advocate
Advocate

Dear Respected @sorin.brinzaru ,

 

Please give some help guide for these

 

We need these very urgently to Add Tokens for Showing Automated Elevations of every embeds on GA drawings and also for every panels corners we need to show chamfer types on the GA Drawings

 

Typing Data here is too much Tedious.

Please

Please Please give some good guides how can we write these scripts properly to achieve all we need in drawings(GA , Assembly automatically)

 

SanjoyNath_0-1637943857585.png

 

We get errors like this

 

SanjoyNath_0-1637944105209.png

 

We want to achieve these with drastic features. Please guide us

 

SanjoyNath_1-1637944248821.png

 

Sanjoy Nath
BIM Manager And Digital Lead (Structures Online)
BOOST, AR , VR ,EPM,IFC API,PDF API , CAD API ,Revit API , Advance Steel API
Founder of Geometrifying Trigonometry(C)
0 Likes
Message 4 of 5

sorin.brinzaru
Autodesk
Autodesk

Hi @SanjoyNath ,
Let me see if I understand correctly your request. You want to create a custom token ? I'm not sure this is possible through API / VBScripts.
The error you get in the first picture is because you typed the script in the wrong view (you need to press the q symbol first) and you got some unnecessary generated #Newline tokens in your script.
By using this method of writing VBScript code in Label Manager I don't think you can access the labeled object.
There is another place where you can write VBScripts and you have object access, but only for filtering purposes. See the attached picture with Detail Style Manager options. So theoretically you can filter your specific objects and create a specific label for them. But you have to use tokens provided by Advance Steel.
I also attached a picture with the table containing the existing filtering scripts.
Not sure if this approach can help you with your specific task, but it's worth knowing about it.

Message 5 of 5

Sebastian_Eiche
Mentor
Mentor

for me, it looks like he just wanted to know where he could add this scripts directly in the Detail Style manager or not? 
For sure there could be done a bit more, but from his post I think he only want to know how the label could be done with a script automatic and not afterwards.

 

So in the DSM you had to know which label strategy you had (or want) to change:

Sebastian_Eiche_0-1640790723005.png

 

Now chnage the category to label strategies, found the rule and change it.

Sebastian_Eiche_1-1640790787610.png

 

If it's a specific one for a few objects, it's maybe better to create a new strategy first.


Sebastian Eiche
Application Engineer @Mensch und Maschine acadGraph

EESignature

If this information was helpful, please use the Accept as Solution function, this make it easier for other users