rlx Posted December 22, 2021 Posted December 22, 2021 you could try adding garbage collection command (gc) but it would slow down the routine. Or add a counter and when it reaches lets say 1000 , do (GC) and reset counter. ... (foreach block (ss->ol ss) (gc) ;;; qui definisce cosa sono tag1, tag2 e tag3 tra le proprietà del blocco ... else buy more ram ? else I think splitting dwg is only way... Quote
hpimprint Posted December 22, 2021 Author Posted December 22, 2021 i will try, thank you. (ram is 16Gb .... i can't add more ) i will test on another pc having 32Gb ram. Quote
hpimprint Posted December 22, 2021 Author Posted December 22, 2021 please, could you insert in the script the counter to 1000 before activating (gc)? Quote
rlx Posted December 22, 2021 Posted December 22, 2021 (defun c:blockschangenameandlayer ( / ss tag1 tag2 tag3 lay count max-count) (setq count 0 max-count 1000) (if (setq ss (ssget "x" '((0 . "insert")))) (foreach block (ss->ol ss) ;;; qui definisce cosa sono tag1, tag2 e tag3 tra le proprietà del blocco (setq tag1 (gav block "systemId") tag2 (gav block "PipelineID") tag3 (gav block "keyword")) (if (and tag1 tag2 (setq tag1 (validsn tag1)) (setq tag2 (validsn tag2))) (cond ((and tag3 (setq tag3 (validsn tag3)) (eq (strcase tag3) "SUPPORT")) ;;; se keyword=SUPPORT aggiunge al nome layer "-SUPPORT" (create_layer (setq lay (strcat tag1 "-" tag2 "-" tag3))) (vla-put-layer block lay)) (t (create_layer (setq lay (strcat tag1 "-" tag2))) (vla-put-layer block lay)) ) ) (if (< count max-count)(setq count (1+ count))(progn (setq count 0)(gc))) ) ) (princ) ) Quote
hpimprint Posted December 23, 2021 Author Posted December 23, 2021 it worked! memory problem solved! thank you Quote
rlx Posted December 23, 2021 Posted December 23, 2021 you're welcome. You can try to set max-count to higher value like 10.000 or 100.000 if routine becomes to slow but if it works then it works Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.