hank
July 31, 2018, 1:17pm
43
All Set… here is the logged issue.
opened 01:08PM - 31 Jul 18 UTC
bug
Ruby API
SketchUp
need more info
1. SketchUp/LayOut Version: SU2018 Pro (Sketchup.version_number = 1800016976)
2… . OS Platform: Mac OSX High Sierra 10.13.6
MacBook Pro (Retina, 15-inch, Early 2013)
NVIDIA GeForce GT 650M 1024 MB
Intel HD Graphics 4000 1536 MB
2.4 GHz Intel Core i7
8 GB 1600 MHz DDR3
(however also re-producable on other Mac setups)
Describe briefly what you are doing and what is happening.
Wanted to take a group containing many solid sub groups and union ALL of them by looping through each of the group's entities.
Describe what the expected result is.
The expected result would be a single group that has been unioned.
What happens: the operation will appear to complete, printing the appropriate time elapsed to the console, but then SU will lock up, with the spinning rainbow cursor. During this time, observing the memory usage in the Activity Monitor in this “afterward” period, Sketchup starts with at about 120 MB allocated and continues to jump upward by about 25MB increments until it peaks at 440 MB when SU finally begins to react again. The operation will be successful but will have hung for a long period. Sometimes SU will crash outright if too much geometry is fed into solid_ops_all_entities. Running the same operation with Enroth Union (commented out below) is almost instantaneous.
I have 8 gig of RAM, 3.4 of which is allocated when I start this operation and 4.5 when complete.
```ruby
def solid_ops_all_entities(group_in)
Sketchup.active_model.start_operation('Union All Entities', true)
time_start = Time.now
if(group_in.entities.length>1)
# convert entity list into array
temp_solid_array = group_in.entities.to_a
# remove the first member from of array and define as new variable
solid_result = temp_solid_array.shift
# run union on each item in remaining array
temp_solid_array.each{|item|
if item.is_a? Sketchup::Group
next unless item.valid? && item.manifold?
#print "ATTEMPTING TO PERFORM SOLID OPERATION ON #{item} AND #{solid_result}\n"
solid_result = item.union(solid_result)
# Enroth on the other hand works fine.
#Eneroth::SolidTools::SolidOperations::union(solid_result,item)
end
}
# output results
if(solid_result)
solid_result.name = 'SOLID_RESULT'
print "SOLID OPERATION SUCCESSFUL\n"
else
print "Solid Operation Failed. Confirm Primatives are valid solids\n"
end
# clean up
temp_solid_array.clear
end #end of length check
time_end = Time.now
print "TIME ELAPSED = #{time_end - time_start} SECONDS\n"
Sketchup.active_model.commit_operation
end # end solid_ops_all_entities
```
Attach any relevant files.
[solid_tools_memory_leak.skp.zip](https://github.com/SketchUp/api-issue-tracker/files/2245407/solid_tools_memory_leak.skp.zip)
Curiously (and I mentioned this in another post at sketchucation ) “puts” does not work on my setup… I have to use “print”. Other people may be having this issue too because many folks could not get ThomThom’s Material Tools to work either. Maybe I should start another issue if any of you have similar results… the sketchucation post seems to be stale.
1 Like