def create_rectangle
if( @pts[0] != @pts[3] )
face = Sketchup.active_model.active_entities.add_face @pts
entities = model.active_entities
group = entities.add_group(face)
end
self.reset
end
Your partial code is a mess.
Let’s us assume that create_rectangle gets called when something happens to an array of points you are collecting…
e.g. @pts[3] is defined as the final corner.
How do we get ‘here’ ?
Next,
face = Sketchup.active_model.active_entities.add_face(@pts)
Should work, provided that the 4 points are coplanar…
But then you make a reference to ‘model’ without having defined it !
This would be far more logical…
entities = Sketchup.active_model.active_entities
face = entities.add_face(@pts)
group = entities.add_group(face)
I think you are at it again ! not reading what you write…
Look at each line and see if it will work…
If something doesn’t work read the error-message.
Tell us the message if you don’t understand it…
Again making the group before adding the face means that the danger of merging with existing geometry is avoided…
entities = Sketchup.active_model.active_entities
group = entities.add_group()
face = group.entities.add_face(@pts)
In this case a simple fix is possible - always assuming that @pts is getting made properly beforehand…