[Question] Calling subscripts using CALL command in Smartparts!


How to use CALL procedure to call another subscript where you have part of your script. For instance, how to put into subscript drawing a reinforcement bar, so that you call this like a procedure to do drawing task?
Whatever I try is not working as the subscript does not behave properly and does not remember parameters even if I pass them to the procedure in subscript?
Do you have any simple example to illustrate how to use CALL command?
From my perspective it would be good practice to keep UI parameters in the main script, but do just drawing some parts in the procedure stored in subscript!
Any suggestion is welcome.
Primoz

Show most helpful answer Hide most helpful answer

Everything is in the online help. There is nothing more.
Practice makes perfect or, as the French proverb says, forging makes a blacksmith.


1 - 10 (14)

Any example of how to use CALLFUNCTION?

Hi,

I prepared an example, where we have things very simple:

1) Subscript and the main script are both copied in the same directory
2) Subscript is running without any problem
3) From the main script I am trying to call subscript using CALL function

Whatever I do, the subscript cannot be run from the main script. I have no idea why??

Any suggestions are welcome as thing does not work!!!

Primoz

Scripts are on the following address:
https://www.dropbox.com/sh/bke9jtggoo7f7w5/AACa3fpgJZY2VA5f9MWaMkuDa?dl=0

I really see no reason why so much problems with just calling another script. This is a must for modular software development which is very well enabled here.
We just need to find a way to call another script so that there will not be at each script problems - it means it should be simple and universal way that it will work always.
Funny thing is that even if I provide full path of the script without extension, the same result - the script is not found as nothing is done in UI of dialog box.

Hello,

There is always a reason when something is wrong, but sometimes the reason is overlooked.
I just took a look without trying the SmartPart completely but this is what I see:

Suppress the "," before "PARAMETERS_RETURN".
And there is a RETURN without GOSUB in 3D script.


Attachments (1)

img
2020-05-03_16h56_22.png
Type: image/png
Downloaded 7 times
Size: 2,82 KiB

Hi,

I corrected both things, but it still does not work, nothing is called actually as dialog box which should have called script UI is empty!

Primoz

https://www.dropbox.com/s/0ff2yex569a43gk/CALL.pdf?dl=0

Hello,

As I said, there is a reason: if you look at your PDF file, you can see that the called macro doesn't exist!
You saved your Sub-SmartPart in a folder and you call it in another one.
If you save your Sub-SmartPart in "...\Engineering\Concrete\Columns", everything will run fine...
Or, change the path where the Sub-SmartPart is saved in the parameters of the Sub-SmartPart.


Attachments (1)

img
2020-05-03_18h09_25.png
Type: image/png
Downloaded 7 times
Size: 30,62 KiB

Hi,
thanks a lot, this was the main reason not finding the subscript!
Is it any possibility that there would be a function which you could call to get the exact location of the subscripts? So that you can get this path to one variable in Smartparts language.
If such function does not exist, maybe file path is stored in registry where Allplan is installed. Do you have this information? It would be of great help!

I do not see it in Smartparts help!
Primoz

No, this information must be defined by the developper in the SmartPart parameters.
Do not look elsewhere.

Please, check "Is solution" in the message with the solution. It could help someone else.


So which function to use, to get the location on disk where you should copy custom defined smartpart scripts, so that they would work automatically?

1 - 10 (14)

https://campus.allplan.com/ uses cookies  -  More information

Accept