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] Low smartpart


Hi, this code works but it is very slow and i dont understand why. Can anyone tell me why?

n_can = 24
ang = 360/n_can

ROTY -90

GROUP "fu"
REVOLVE 4 , 360 , 1 + 2 + 4 + 8 ,
0 , 0 , 1 ,
0 , r / 2 , 1 ,
REF_X , r / 2 , 1 ,
REF_X , 0 , 1
GROUP_END
!GROUP_PLACE fu

GROUP "can"
TRANS d , 0 , 0
ROTY 90

FOR n = 1 TO n_can

EXTRUDE 2 , 0 , 0 , REF_X - d , 1 + 2 + 4 ,
r / 2 , 0 , 900 , !centro
rc , 360 , 4000

ROTZ ang
NEXT
RESTORE n + 2

GROUP_END
!GROUP_PLACE can

GROUP "sf"
FOR n = 1 TO n_can
TRANS d , -r/ 2 , 0
SPHERE rc
RESTORE 1
ROTX ang
NEXT
RESTORE n + 2
GROUP_END
!GROUP_PLACE sf

res = ""
res = GROUP_UNION ( "sf" , "can" )
res_1 = GROUP_DIFF ( "fu" , res )
GROUP_PLACE res_1

Anhänge (1)

Typ: image/jpeg
45-mal heruntergeladen
Größe: 127,43 KiB

Hi Danilos,

GROUP_UNION and GROUP_DIFF dramatically increase execution time.
It might be better to make an element and then copy it 24 times around the axis.


This is a very cumbersome code!

This part
---------------------
ROTY -90

GROUP "fu"
REVOLVE 4 , 360 , 1 + 2 + 4 + 8 ,
0 , 0 , 1 ,
0 , r / 2 , 1 ,
REF_X , r / 2 , 1 ,
REF_X , 0 , 1
GROUP_END
!GROUP_PLACE fu
--------------
you can replace with
--------------------
GROUP "fu"
CYLIND REF_X,r / 2
GROUP_END
!GROUP_PLACE fu
-------------------

Also you can replace
-----------------
EXTRUDE 2 , 0 , 0 , REF_X - d , 1 + 2 + 4 ,
r / 2 , 0 , 900 , !centro
rc , 360 , 4000
-----------------
with
----------------
TRANS r / 2,0,0
CYLIND REF_X - d , rc
RESTORE 1
----------------

The other problem is the spheres!

These have 512 faces, and generate 24 subtraction bodies (cannelures) with 512+32+1 faces each.

GROUP_UNION combines these cannelures into a body with 13,080 faces. This takes so long because it is done step by step:
1st step: 1st cannelure + 2nd cannelure -> process “intersected” for all faces with the other faces 545 x 545 = 297,025 times.
2nd step: 1st step + 3rd cannelure -> process “intersected” for all faces with the other faces (545+545) x 545 = 594,050 times.
3rd step: 2nd step + 4th cannelure -> process “intersected” for all faces with the other faces (545+545+545) x 545 = 891,075 times.
...
24th step: 23th step + 24th cannelure -> process “intersected” for all faces with the other faces (23x545) x 545 = 6,831,575 times.

And then with GROUP_DIFF from the basic body with 34 faces
this cannelures body with 13,080 faces is subtracted. In doing so, 34 x 13,080 = 444,720 times one face is “intersected” with the other.

Unfortunately, this takes some time!

Proposal:
Create a pie slice (1/24th) of the column with the cannelure in on group "pie".
Then place this "pie" 24 times with a rotation of 360/24 degrees in between at the center.

n_can = 24
ang = 360 / n_can
r = 0.5
d = 0.04
rc = d / 2

GOSUB "create_pie"

FOR n = 1 TO n_can
GROUP_PLACE "pie_can"
ROTZ ang
NEXT

END

"create_pie":
GROUP "pie"
ROTZ -ang / 2
EXTRUDE 2 , 0 , 0 , REF_X , 1 + 2 + 4 ,
0 , 0 , 0 , !point
r / 2 , 0 , 0 , !point
0 , 1 , 800 , !tangent direction
r / 2 , ang , 2000 , !arc
0 , 0 , 0 !point
RESTORE 1
GROUP_END
!GROUP_PLACE "pie"

GROUP "can"
TRANS r / 2, 0, d
CYLIND REF_X - d , rc
SPHERE rc
GROUP_END
!GROUP_PLACE "can"

GROUP "pie_can"

res=""
res=GROUP_DIFF ("pie","can")
GROUP_PLACE res
GROUP_END
!GROUP_PLACE res

RETURN

Anhänge (1)

Typ: text/xml
58-mal heruntergeladen
Größe: 9,53 KiB

Zitiert von: Nemo
This is a very cumbersome code!
This part

---------------------

ROTY -90
GROUP "fu"

REVOLVE 4 , 360 , 1 + 2 + 4 + 8 ,

0 , 0 , 1 ,

0 , r / 2 , 1 ,

REF_X , r / 2 , 1 ,

REF_X , 0 , 1

GROUP_END

!GROUP_PLACE fu

--------------

you can replace with

--------------------

GROUP "fu"

CYLIND REF_X,r / 2

GROUP_END

!GROUP_PLACE fu

-------------------
Also you can replace

-----------------

EXTRUDE 2 , 0 , 0 , REF_X - d , 1 + 2 + 4 ,

r / 2 , 0 , 900 , !centro

rc , 360 , 4000

-----------------

with

----------------

TRANS r / 2,0,0

CYLIND REF_X - d , rc

RESTORE 1

----------------
The other problem is the spheres!
These have 512 faces, and generate 24 subtraction bodies (cannelures) with 512+32+1 faces each.
GROUP_UNION combines these cannelures into a body with 13,080 faces. This takes so long because it is done step by step:

1st step: 1st cannelure + 2nd cannelure -> process “intersected” for all faces with the other faces 545 x 545 = 297,025 times.

2nd step: 1st step + 3rd cannelure -> process “intersected” for all faces with the other faces (545+545) x 545 = 594,050 times.

3rd step: 2nd step + 4th cannelure -> process “intersected” for all faces with the other faces (545+545+545) x 545 = 891,075 times.

...
24th step: 23th step + 24th cannelure -> process “intersected” for all faces with the other faces (23x545) x 545 = 6,831,575 times.
And then with GROUP_DIFF from the basic body with 34 faces

this cannelures body with 13,080 faces is subtracted. In doing so, 34 x 13,080 = 444,720 times one face is “intersected” with the other.
Unfortunately, this takes some time!
Proposal:

Create a pie slice (1/24th) of the column with the cannelure in on group "pie".

Then place this "pie" 24 times with a rotation of 360/24 degrees in between at the center.
n_can = 24
ang = 360 / n_can
r = 0.5
d = 0.04
rc = d / 2
GOSUB "create_pie"
FOR n = 1 TO n_can GROUP_PLACE "pie_can" ROTZ ang
NEXT
END
"create_pie":
GROUP "pie"
ROTZ -ang / 2
EXTRUDE 2 , 0 , 0 , REF_X , 1 + 2 + 4 ,
0 , 0 , 0 , !point

r / 2 , 0 , 0 , !point

0 , 1 , 800 , !tangent direction

r / 2 , ang , 2000 , !arc

0 , 0 , 0 !point

RESTORE 1
GROUP_END
!GROUP_PLACE "pie"
GROUP "can"
TRANS r / 2, 0, d

CYLIND REF_X - d , rc
SPHERE rc
GROUP_END
!GROUP_PLACE "can"
GROUP "pie_can"
res=""

res=GROUP_DIFF ("pie","can")

GROUP_PLACE res

GROUP_END
!GROUP_PLACE res
RETURN


Thank you Nemo for indications and Test, and thank you Bertrand . I try to make