Sketchup2018 viewport performance issue

Caul, your code won’t even run on my mac without locking up the entire computer…

I tweaked it to find the locking point and at about 400,000 points the viewport goes solid black and then the computer locks… [ unless I’m quick ]

The lock happens around the same time and the viewport goes black with or without my view_refresh, but a least it gives me some warning…

mod = Sketchup.active_model
ents = mod.entities
side = 300.m
side_pts = 100
pts = []
dd = side / (side_pts - 1)

(0..side_pts - 1).each { |x|
  (0..side_pts - 1).each { |y|
    (0..side_pts - 1).each { |z|
     pts << [x * dd, y * dd, z * dd]
}}}

view = mod.active_view

mod.start_operation("Add cPoints", true)
count = 0
# I adjust this upwards until the lock...
pts[0..299999].each do|i|
  count += 1
  ents.add_cpoint(i)
  if count.modulo(1000) == 0
    view.refresh #&& view.zoom_extents
  end
end
mod.commit_operation

I’ve seen this with bulk operations on my mac’s in the past, where I had to ‘chunk’ the geometry generation for it to all complete…

this appears to be a cpu overload that wipes out the graphics…

john