Can you help me understand this OOTB VB Script

Can you help me understand this OOTB VB Script

Julio_Soto
Advisor Advisor
1,373 Views
9 Replies
Message 1 of 10

Can you help me understand this OOTB VB Script

Julio_Soto
Advisor
Advisor

I've written many LISPS but just getting started with VB Scripting.  I saw this out of the box script in the style map of the process manager but I guess I'm not following the logic. Here is how I understand it.

 

If the whole function returns true then it will create a drawing as mapped in the Detail style Map. But it doesn't make sense to me because the map style it is using is a "standalone" detail style.  the script seems to say if the object is standalone then the script returns false and it should not create a drawing.  I must be interpreting this incorrectly

Julio_Soto_0-1619648786910.png

This is the script from AS style map

 

'This script excludes the objects which are Standalone
Function checkElement(Obj)  'Do all scripts need to begin with this function?
    bValid = True           'just looks like a variable to me
    If Obj.Standalone = False Then  'Check if an object is Standalone
         bValid = False     'If it is standalone then variable = false
    End If                   'end if statement
    checkElement = bValid    'Pass the "False" value to the function?
End Function                 'ends the function. If the object is stand alone
                              'then it is false and should output false and
                              'skip the part correct?

 

 

Accepted solutions (1)
1,374 Views
9 Replies
Replies (9)
Message 2 of 10

Sebastian_Eiche
Mentor
Mentor
Accepted solution

@Julio_Soto  schrieb:
'This script excludes the objects which are Standalone
Function checkElement(Obj)  'Do all scripts need to begin with this function?
    bValid = True           'just looks like a variable to me
    If Obj.Standalone = False Then  'Check if an object is Standalone
         bValid = False     'If it is standalone then variable = false
    End If                   'end if statement
    checkElement = bValid    'Pass the "False" value to the function?
End Function                 'ends the function. If the object is stand alone
                              'then it is false and should output false and
                              'skip the part correct?
  • FunctionCheckElement(obj) --> yes this is the start of the script
  • bValid = true :: token which is used, the start value is set to "true"
  • now the command ich checking if the part which should be detailled is a "standalone" part, if this is false, the bValid value is changed to "false" otherwise the bValid token keeps "true".

So in the end, the checkElement will set to the token bValid and so if bValid is true, checkelement is true and a drawing will be created. if the value is false, nothing happened, because the checkElement will also false


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

Message 3 of 10

SanjoyNath
Advocate
Advocate

Thank you very much Sir @Sebastian_Eiche 

Please help us in Lisp @Julio_Soto  to achieve all the HYPE_ type commands as we see in hyperbonus.lsp 

please help us to convert all dot net interop dll files to .tlb or .olb to achieve more features in Drawings Automations

 

For Object lisps vba we can help you thoroughly

 

To understand the scripts here , best practice is take excel 2003(not higher version) and go to vba and then tools references

Choose the .tlb file from the ADVS folder and then press F2 (Object browser)

Then you will understand why standalone is different from the singlepart

SinglePart=Assembly means standalone (Which is special category for Advance Steel)

 

SanjoyNath_0-1619694131179.png

 

 

I strongly believe that HRL (Hyper steel has made everything with lisp , vlx then Graitek hided these and converted to com components with c++ and vb6

Autodesk enforced things to c++ and dot net

 

 

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)
Message 4 of 10

SanjoyNath
Advocate
Advocate

Dear Experts,

 

Some deeper understanding here

 

\Kernel\Data\AstorDetailsBase.mdf

 

Script1%%script(If("%StartX"="%EndX" And "%StartY"="%EndY")Or("%EndX"="") Then appendString("(%StartX/%StartY)") Else If "%StartX"="" And "%EndX"<>"" Then appendString("(%EndX/%EndY)") Else appendString("(%StartX/%StartY)/(%EndX/%EndY)") End If)

 

DSCScript (Internally lisp is called from the vlx  lisps)

 

 

 

Advance Steel %MethodNumber% =

Preliminary number Equal PArt+ Script Methods in Astor Kernel databases

 

If these vba are changed , then the %MethodNumber% changes

 

AstorKernel mdf files uses the Numbering Scripts which uses the EQUALPARTOBJECTS   (Which are generated through the preliminary numbering methods of HyperSteel HRL cores and then the method numbers are generated through scripts)

 

.\ADVS\CompoundBeam.dll scripthost calls 32 bit modules 9549 hypersteel lisps vba ScriptHost.dll
.\ADVS\DSCRootsCOM8x64.dll scripthost calls 32 bit modules 5356 hypersteel lisps vba ScriptHost.dll
.\ADVS\Main.dll scripthost calls 32 bit modules 214197 hypersteel lisps vba ScriptHost.dll
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 61655 hypersteel lisps vba ScriptHost.FormObj.1
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 61660 hypersteel lisps vba ScriptHost.FormPropPage.1
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 61736 hypersteel lisps vba SECScriptHostDoc
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 61745 hypersteel lisps vba SECScriptHostView
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 66147 hypersteel lisps vba .?AVSECAScriptHost(sset obj)
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 66151 hypersteel lisps vba .?AVSECScriptHostDocDummyWnd(IASTObject obj)
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 66152 hypersteel lisps vba .?AVSECScriptHostDoc(NCObject Obj)
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 66157 hypersteel lisps vba .?AVSECScriptHostView(EqualPartObject Obj)
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 68398 hypersteel lisps vba JScriptHostWW
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 68438 hypersteel lisps vba __MIDL___MIDL_itf_ScriptHost_0001_0000_0001W
.\ADVS\OTP602asu9.dll scripthost calls 32 bit modules 69203 hypersteel lisps vba ScriptHost.Document
.\ADVS\ScriptHost.dll scripthost calls 32 bit modules 751 hypersteel lisps vba d:\B\3\S19\src\Dev\Binaries\x64\Release\ScriptHost.pdb
.\ADVS\ScriptHost.dll scripthost calls 32 bit modules 810 hypersteel lisps vba ScriptHost.dll
.\ADVS\ScriptHost.dll scripthost calls 32 bit modules 923 hypersteel lisps vba ScriptHost.dll Module
.\ADVS\ScriptHost.dll scripthost calls 32 bit modules 927 hypersteel lisps vba ScriptHost.dll
.\ADVS\ScriptHost.dll scripthost calls 32 bit modules 932 hypersteel lisps vba ScriptHost.dll

 

 

 

 

 

.\ADVS\CompoundBeam.dll calls modules 9545 ?getInstance.DSCScriptEngine:: ASTObject ->SAPEAV1.XZ
.\ADVS\CompoundBeam.dll calls modules 9546 ?getObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAPEAUIUnknown:: string * Z
.\ADVS\CompoundBeam.dll calls modules 9547 ?addObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAUIUnknown:: string * Z
.\ADVS\CompoundBeam.dll calls modules 9548 ?addCode.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0_N.Z
.\ADVS\DSCRootsCOM8x64.dll calls modules 5352 ?getInstance.DSCScriptEngine:: ASTObject ->SAPEAV1.XZ
.\ADVS\DSCRootsCOM8x64.dll calls modules 5353 ?getObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAPEAUIUnknown:: string * Z
.\ADVS\DSCRootsCOM8x64.dll calls modules 5354 ?addObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAUIUnknown:: string * Z
.\ADVS\DSCRootsCOM8x64.dll calls modules 5355 ?addCode.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0_N.Z
.\ADVS\Main.dll calls modules 214185 ?getInstance.DSCScriptEngine:: ASTObject ->SAPEAV1.XZ
.\ADVS\Main.dll calls modules 214186 ?addCode.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0_N.Z
.\ADVS\Main.dll calls modules 214187 ?callFunction.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0PEAUIUnknown:: ASTObject ->AEA_N.Z
.\ADVS\Main.dll calls modules 214188 ?reinitialize.DSCScriptEngine:: ASTObject ->QEAAXXZ
.\ADVS\Main.dll calls modules 214189 ?addLibrary.DSCScriptEngine:: ASTObject ->QEAAHAEBU_GUID:: ASTObject ->KK.Z
.\ADVS\Main.dll calls modules 214190 ?hasCategory.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: string * Z
.\ADVS\Main.dll calls modules 214191 ?setNames.DSCScriptEngine:: ASTObject ->SAXAEBVAstString:: ASTObject ->00.Z
.\ADVS\Main.dll calls modules 214192 ?setWnd.DSCScriptEngine:: ASTObject ->QEAAXPEAUHWND__:: string * Z
.\ADVS\Main.dll calls modules 214193 ?hasObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: string * Z
.\ADVS\Main.dll calls modules 214194 ?addObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAUIUnknown:: string * Z
.\ADVS\Main.dll calls modules 214195 ?getObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAPEAUIUnknown:: string * Z
.\ADVS\Main.dll calls modules 214196 ?callFunction.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0PEAUIUnknown:: ASTObject ->AEAV2:: ASTObject ->Z
.\ADVS\ScriptHost.dll calls modules 811 ??0DSCScriptEngine:: ASTObject ->IEAA.XZ
.\ADVS\ScriptHost.dll calls modules 812 ??0DSCScriptEngine:: ASTObject ->QEAA.AEBV0:: ASTObject ->Z
.\ADVS\ScriptHost.dll calls modules 813 ??1DSCScriptEngine:: ASTObject ->MEAA.XZ
.\ADVS\ScriptHost.dll calls modules 814 ??4DSCScriptEngine:: ASTObject ->QEAAAEAV0.AEBV0:: ASTObject ->Z
.\ADVS\ScriptHost.dll calls modules 815 ??_7DSCScriptEngine:: ASTObject ->6B.
.\ADVS\ScriptHost.dll calls modules 816 ?__autoclassinit2.DSCScriptEngine:: ASTObject ->QEAAX_K.Z
.\ADVS\ScriptHost.dll calls modules 817 ?addCode.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0_N.Z
.\ADVS\ScriptHost.dll calls modules 818 ?addLibrary.DSCScriptEngine:: ASTObject ->QEAAHAEBU_GUID:: ASTObject ->KK.Z
.\ADVS\ScriptHost.dll calls modules 819 ?addObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAUIUnknown:: string * Z
.\ADVS\ScriptHost.dll calls modules 820 ?callFunction.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0AEAV2:: ASTObject ->Z
.\ADVS\ScriptHost.dll calls modules 821 ?callFunction.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0PEAUIUnknown:: ASTObject ->AEAV2:: ASTObject ->Z
.\ADVS\ScriptHost.dll calls modules 822 ?callFunction.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->0PEAUIUnknown:: ASTObject ->AEA_N.Z
.\ADVS\ScriptHost.dll calls modules 823 ?getBreak.DSCScriptEngine:: ASTObject ->QEBA_NXZ
.\ADVS\ScriptHost.dll calls modules 824 ?getInstance.DSCScriptEngine:: ASTObject ->SAPEAV1.XZ
.\ADVS\ScriptHost.dll calls modules 825 ?getObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: ASTObject ->PEAPEAUIUnknown:: string * Z
.\ADVS\ScriptHost.dll calls modules 826 ?hasCategory.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: string * Z
.\ADVS\ScriptHost.dll calls modules 827 ?hasObject.DSCScriptEngine:: ASTObject ->QEAAHAEBVAstString:: string * Z
.\ADVS\ScriptHost.dll calls modules 828 ?m_strAppName.DSCScriptEngine:: ASTObject ->1VAstString:: ASTObject ->A
.\ADVS\ScriptHost.dll calls modules 829 ?m_strDocName.DSCScriptEngine:: ASTObject ->1VAstString:: ASTObject ->A
.\ADVS\ScriptHost.dll calls modules 830 ?m_strLongDocName.DSCScriptEngine:: ASTObject ->1VAstString:: ASTObject ->A
.\ADVS\ScriptHost.dll calls modules 831 ?pSingleton.DSCScriptEngine:: ASTObject ->1PEAV1.EA
.\ADVS\ScriptHost.dll calls modules 832 ?reinitialize.DSCScriptEngine:: ASTObject ->QEAAXXZ
.\ADVS\ScriptHost.dll calls modules 833 ?reinitializeCode.DSCScriptEngine:: ASTObject ->QEAAXXZ
.\ADVS\ScriptHost.dll calls modules 834 ?setBreak.DSCScriptEngine:: ASTObject ->QEAAX_N.Z
.\ADVS\ScriptHost.dll calls modules 835 ?setNames.DSCScriptEngine:: ASTObject ->SAXAEBVAstString:: ASTObject ->00.Z
.\ADVS\ScriptHost.dll calls modules 836 ?setWnd.DSCScriptEngine:: ASTObject ->QEAAXPEAUHWND__:: string * Z
.\ADVS\ScriptHost.dll calls modules 911 .?AVDSCScriptEngine:: ASTObject ->

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 5 of 10

Julio_Soto
Advisor
Advisor

Ok, so maybe I am not understanding the comment.

 

'This script excludes the objects which are Standalone

 

It seems to me this script excludes objects that are NOT standalone.  Is the comment correct? I know the comment has nothing to do with the script, but I guess that is what was confusing me.

Message 6 of 10

Sebastian_Eiche
Mentor
Mentor

from my point of view the script is working not correct 😁 

'This script excludes the objects which are Standalone
Function checkElement(Obj)  
    bValid = True                   'we start with bValid=true
    If Obj.Standalone = False Then  'obj.standlone property send a "true" or 
                                    "false" in the case of "false" --no 
                                    standalone object the script use "then" 

         bValid = False             'now the token is set to false!
    End If                          'end if statement
    checkElement = bValid           'in case of no standalone object the 
                                     checkelement is set to false 
End Function                 

 

let us try a conversation between a standalone part and this process script (this is what my brain did =):

S: "hi I'm a standalone please create a detail from me"

P: "sorry, I think you're a standalone part but had to check it! are you a standalone part?" (start with bValid=true, then have a look for the "if")

S: "yes this is true" (so the bValid should be keep true or not?)

P: "ok here we go"

 

So from my point of view it should be like this, but maybe I'm doing something wrong

'This script excludes the objects which are Standalone
Function checkElement(Obj)  
    bValid = false           
    If Obj.Standalone = true Then  
         bValid = true     
    End If                   
    checkElement = bValid    
End Function

 

 


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

Message 7 of 10

Julio_Soto
Advisor
Advisor

are you familiar with ELI5 subreddit? That's what your response reminded me of lol 🙂 

 

I actually think both scripts work. I think it's the comment that is incorrect

 

In the first script, it starts with the assumption that you are a stand-alone part (bValid = True).  Then it will verify (if statement). If your not a standalone part, it will change your status to false (bValid = False). then the entire script is false and the script will not create a drawing. If you ARE a standalone part the script does nothing and leaves your original status (bValid = True) and create a drawing. 

 

Your script starts with the assumption that you are lying 😉 (bValid = False). So the script will verify if You are telling the truth. If you are it will change your status to true and create a drawing. If you are lying it keeps the status the same and does not create a drawing. 

 

From the comment, I was expecting the opposite result.  I was expecting the script to ignore standalone parts, but it was doing the opposite.  I think that's what threw me off.

 

Also, when I was testing it kept failing. After reading some scripting documentation I read that you need to restart AS or call "AstorReopenDatabase" command for the script to work.  

 

For anyone interested, here is a link to an AU University course on this

 

https://www.autodesk.com/autodesk-university/class/Advance-Steel-Hands-Extending-Detailing-Capabilit...

Message 8 of 10

Sebastian_Eiche
Mentor
Mentor

yes for sure in my script is an error, now it should exclude standalone parts (late in the evening here =):

'This script excludes the objects which are Standalone
Function checkElement(Obj)  
    bValid = true           
    If Obj.Standalone = true Then  
         bValid = false     
    End If                   
    checkElement = bValid    
End Function

 Or did I miss something now? I should not do such things in the night...I will leave now 😴


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

Message 9 of 10

Sebastian_Eiche
Mentor
Mentor

@Julio_Soto  schrieb:

are you familiar with ELI5 subreddit? That's what your response reminded me of lol 🙂 


Yes I know it and this is how my brain works  🤗


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

0 Likes
Message 10 of 10

SanjoyNath
Advocate
Advocate

Dear @Julio_Soto 

 

'(Here we can write anything irrespective of scripts actual working)This script excludes the objects which are Standalone
Function checkElement(Obj)  ' Obj is the IAstObject which is Interface to AST Object (Any type of object of Advance Steel)
    booleanSanjoyNath = False          ' The First thing is that we take it false
    If Obj.Standalone = False Then  'Check if an object is Standalone SinglePart Assembly and it is Main Part also   (Advance Steel Preliminary numbering decides this automatically)
         booleanSanjoyNath = False     'If it is standalone then variable = false
Else
booleanSanjoyNath = True  ' The Script need to take care for Else condition everytime
    End If                   'end if statement
    checkElement = booleanSanjoyNath    ' Functions name = variable name is the Visual basic convention to say return types
End Function                 'ends the function. 











' i am giving one advanced type of DPM script here which logs in file when it generates the drawings through specific DSM

see

'Returns true for stair
Function checkElement(Obj)
'On Error Resume Next
checktypes=False
 
objroleobjectname=UCase(Obj.RoleObject.Name)
 
MsgBox("STAIR SCRIPT Obj.RoleObject.Name objroleobjectname        Obj.RoleObject.ClassType   =" & Obj.RoleObject.Name &"   " & Obj.RoleObject.ClassType)
    'Verify only for Stringer
   pos_found=InStr(1,objroleobjectname,"STRINGER")
 
If(pos_found>=1) Then
 
 
 
'Dim fs, f As Object 
' Scripting.FileSystemObject
 
                'we need to check in DPM scripts
 
 
Dim fs, f 
MsgBox("Crossed Dim fs, f ")
 
'Set fsinteractions =Interaction.CreateObject("Scripting.FileSystemObject")
' MsgBox("Crossed Set fsinteractions")
'Set vbafsinteractions =VBA.Interaction.CreateObject("Scripting.FileSystemObject")
' MsgBox("CrossedSet vbafsinteractions")
 
Set fs =CreateObject("Scripting.FileSystemObject")
MsgBox("Crossed    Set fs =CreateObject(      Scripting.FileSystemObject     ForAppending=8     ) ")
 
 
Set f = fs.OpenTextFile("d:\\testfile.txt", 8)
MsgBox("CrossedSet f = fs.OpenTextFile  , 8")
 
'Call f.Write(vbCrLf & "STAIR   SCRIPT   strToCheckRole=" & strToCheckRole & "        " & Str(Now)  & "   " & "Entered into  STRINGER  pos_found=" & CStr(pos_found) & "   " & "STAIR SCRIPT Obj.RoleObject.Name objroleobjectname        Obj.RoleObject.ClassType   =" & Obj.RoleObject.Name &"   " & Obj.RoleObject.ClassType )
 
' f.Write(vbCrLf & "STAIR   SCRIPT   strToCheckRole=" & strToCheckRole & "        " & Str(Now)  & "   " & "Entered into  STRINGER  pos_found=" & CStr(pos_found) & "   " & "STAIR SCRIPT Obj.RoleObject.Name objroleobjectname        Obj.RoleObject.ClassType   =" & Obj.RoleObject.Name &"   " & Obj.RoleObject.ClassType )
 
 
 
f.Write(vbCrLf & "STAIR   SCRIPT   strToCheckRole=" & strToCheckRole & "  Date  Time=    " & Now  & "   " & "Entered into  STRINGER  pos_found=" & (pos_found)  )
 
 
 
MsgBox("Crossed  f.Write")
 
f.Close
 
MsgBox("Crossed f.Close")
 
 
      MsgBox("Entered into  STRINGER  pos_found=" & CStr(pos_found) )
 
 
 
        checktypes = True
 
 
 
       
    End If
 
objroleobjectname=""
checkElement=checktypes
 
End Function

 

I am explaining each line here like ELI5 rules of   ELI5 subreddit

 

 

SanjoyNath_0-1619775983214.png

SanjoyNath_1-1619776028962.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