Author Topic: Grouping entities to process later  (Read 1866 times)

0 Members and 1 Guest are viewing this topic.

ChrisCarlson

  • Guest
Grouping entities to process later
« on: May 15, 2017, 02:33:27 PM »
Is there a way to create selection sets with a maximum number of entities; for example the first 100 entities selected? I'm not really finding anything similar in Google searches which leads me to believe I'm phrasing this wrong.

I'm trying to find a way to split up processing 1,000+ entities so it runs in batches versus stalling AutoCAD.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Grouping entities to process later
« Reply #1 on: May 15, 2017, 02:50:44 PM »
Why use selection sets when you can construct lists?  Or are you attempting to store this information across multiple sessions?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Grouping entities to process later
« Reply #2 on: May 15, 2017, 03:13:23 PM »
Have you seen THIS to help prevent "stalling" cad?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ChrisCarlson

  • Guest
Re: Grouping entities to process later
« Reply #3 on: May 16, 2017, 11:57:23 AM »
Have you seen THIS to help prevent "stalling" cad?

Interesting, approach. I'll try and finagle that into this routine. Looks like it would run within the foreach block I have to process the entities.

Why use selection sets when you can construct lists?  Or are you attempting to store this information across multiple sessions?

Right now I'm using two filtered ssget calls to grab all of the insert references and polyline entities. In a rought approach, in a sense, a "list" of entities, correct? Is it possible in AutoLISP to split this "list" into an n quantity of "sub-lists"? That way I can process each "sub-list" separately.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Grouping entities to process later
« Reply #4 on: May 16, 2017, 12:00:04 PM »
Maybe the code you're running could be optimized so that CAD does not lock up?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Grouping entities to process later
« Reply #5 on: May 16, 2017, 12:11:30 PM »
Why use selection sets when you can construct lists?  Or are you attempting to store this information across multiple sessions?

Right now I'm using two filtered ssget calls to grab all of the insert references and polyline entities. In a rought approach, in a sense, a "list" of entities, correct? Is it possible in AutoLISP to split this "list" into an n quantity of "sub-lists"? That way I can process each "sub-list" separately.

Very easily, using calls to the various list-handling functions like (mapcar ...), (vl-remove-if...), (vl-remove-if-not ...), (member ...), and so on.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Grouping entities to process later
« Reply #6 on: May 16, 2017, 12:14:06 PM »
A small guess:

Code: [Select]
(setq *L* (SS->L))
; (repeat 5
;   (ProcessOnce (lambda (a b) (= (cdr (assoc 8 (entget a))) (cdr (assoc 8 (entget b))))) )
; )
(defun ProcessOnce ( foo / itm )
  (setq itm (car *L*))
  (cond
    ( (setq *L* (cdr *L*))
      (mapcar (function (lambda (x) (foo itm x))) *L*)
      (princ (strcat "\n" (itoa (length *L*)) "objects are left to process."))
    )
  )
)
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg