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] Rereading the Script by Smart Part

Schlagworte:
  • Variable
  • Parameter
  • Scripting

Hi,
I have a question there is any way to force Smart Part to rereading and executing "Master Script" section again when something was changed in section "3D script" (ofcourse this section is already finished). I've calculated some value in 3D script (volume of the 3D element) and I have to use its in Master script or although in 2D but I can't send it to there (with right value).
I've been trying to use the CALL PARAMETER function. I've sent the value of parameter from 3D Script to Parameter but to use it in the section Master script I had to rerun the whole script (It seems too artificial and I'd like to simplyfy this as much as it possible).

Thank you in advance for any help.

David

Anhänge (2)

Typ: image/png
81-mal heruntergeladen
Größe: 52,31 KiB
Typ: image/png
46-mal heruntergeladen
Größe: 32,94 KiB
1 - 10 (11)

Hello,

You can use GOSUB.
First, you move the creation of your groups in an internal subroutine in the Master script.
Then, you call with GOSUB this subroutine in 2D script before you need it and you do the same in the 3D script.

Other possibility: in the Master script, you make a condition to create the groups only with 2D script and 3D script using GLOB_SCRIPT_TYPE and you use the result value where you need it.

Attention: you can not use TRANS in a 2D script, so try to avoid to use TRANS if possible.

Or another possibilty is to use TEXT2 in the 3D script...


When I'm creating a 3D elements in Maaster Script and then I'm trying to substract them the wrong value of volume occurs. Before substraction I wanted to move one of the volume relative to the second one and then substract. The finish volume looks good but I think the GROUP_DIFF ("first_volume","second_volume") function taking these two grups and making substraction but its skip a transition beetwen this two groups. That's why the volume is wrong. I'll try to ilustrate it:

Suppose we want to create two boxes witch are separated and we have to use this same code. If I put this code in Master Script I'll get another result than when I'll put it in 3D script. Maybe I don't know something but I've noticed when I putting code like that in 3D script the volume is correct in another case is not.

And of course I've been trying your first method but the volume was wrong. If it's going about second one I have no idea how to use this GLOB_SCRIPT_TYPE funcion. This what I was able to figure out is that its receive me number with is connected with my current script part but I don't know what I should to do with this afterwards... If you would like to help me with this I would be appreciated.

Anhänge (2)

Typ: image/png
29-mal heruntergeladen
Größe: 29,43 KiB
Typ: image/png
20-mal heruntergeladen
Größe: 35,68 KiB

Hello,

It's due to what I explained: TRANS cannot be used elsewhere than in 3D script.
So, try to make your volume with another function than BOX, maybe with PRISM (see online help here).
It's quite simple but you define the position in X or Y in the parameters of PRISM, without to use TRANS.
If you what to move something in 2D script, use TRANS2, but it's only to move in X and Y axis.


Haah Yes You're right ... I don't know why I didn't use the prism function instead box. Ok this thing I understand but I have one question regardless this example.
Is it possible to use in Master Script any variable which is created until in 3D script. Because the Master script is being read before a 3D and then this variable doesn't exist yet. So I think should be function which force SP to rereading the MS again after reading a 3D, am I right?

You can only force to read a part of the Master script if you use GOSUB and place a subroutine in Master script.
In your case, you can use GOSUB (and the variable is ready if it was created before GOSUB) or you have to create your variable before, in the Master script. This variable is available until the end of the script, including the 3D script.
So, move what you want (or need) in Master script and it will be available in all the scripts.
Master script is always read before each other script, it is like a common header (you can see that the first line number in each script is one more than the last line number of the Master script).


To use GOSUB and place the subroutine in Master script, do like below.

Master script:

...
GOTO "end_master" ! To pass "over" the subroutine

"my_subroutine": 
! Do what you want...
my_result = my_var * 2 
RETURN 

"end_master": ! End of Master script

3D script:

...
my_var = 1 
GOSUB "my_subroutine"
! The value of my_result is now 2 and can be used here
...


Zitiert von: Bertrand_C

Master script is always read before each other script, it is like a common header (you can see that the first line number in each script is one more than the last line number of the Master script).

This thing I know...
Even if I've used PRISM function instead of BOX the volume is wrong. And here is not about that I can't create the model but I can't get right Volume of this model.
Is it possible to get right volume putting the script in "Master stript" section when I'm substracting two volume and at least one of them is moved?

Yes, you can if you only move in X,Y plan.
If in 3D, you need to move in Z, then imagine your volume rotated by a 90° angle and you will create the right one...


Zitiert von: Bertrand_C
Ciao,
Puoi usare GOSUB.

Per prima cosa, sposti la creazione dei tuoi gruppi in una subroutine interna nello script Master.

Quindi, chiami con GOSUB questa subroutine nello script 2D prima di averne bisogno e fai lo stesso nello script 3D.
Altra possibilità: nello script Master, si crea una condizione per creare i gruppi solo con script 2D e script 3D utilizzando GLOB_SCRIPT_TYPE e si utilizza il valore del risultato dove serve.
Attenzione: non puoi usare TRANS in uno script 2D, quindi cerca di evitare di usare TRANS se possibile.
Oppure un'altra possibilità è usare TEXT2 nello script 3D ...


Hi, it's possible make a smartpart (like sketch) with different face_style for the two pcs? Visibility in associative section (no UVS section)!

Anhänge (1)

Typ: image/jpeg
26-mal heruntergeladen
Größe: 55,59 KiB
1 - 10 (11)