Temporary drawing elements vs. invisible objects
-
When I skim through other plugins I see that some create temporary drawing elements (ie. circle, etc. or with followme), take the Points3d and delete the temporary geometry again. This can be easier to write (and maybe also faster because it does the calculations in SU's core instead of Ruby??).
The alternative is to do all calculations with invisible Ruby objects like points, vectors and transformations (what I often prefered with no specific reason).Does the addition of new drawing elements have a bigger impact on SketchUp compared to creating any other (invisible) objects, or does it not matter as long as the entities are deleted again before SketchUp redraws the view?
-
Creating entities in SketchUp is slow! Very slow and it gets slower the more entities you have in the context. It also triggers all kinds of observers etc. If possible, avoid any kind of calculations without temp geometry. ( Some times you have to, like when you want to trigger SU's merge feature to make sure things heal up properly. Or if you need to get the current user axis - then you need to create two dummy groups.)
And yes, using the built in methods of SU for calculations is much faster than trying to do it in Ruby. Make use of the Geom module for all it's worth. For Vertex Tools I even ported the method that calculated soft selection to a C extension because in Ruby it was slow as a sleeping snail. Any calculation, even simple 2 + 2 operations eat time in Ruby - which you notice quickly when you do it in a look.
But the biggest bottleneck is adding entities in SU, and that's not much you can work around other than trying to use the bulk methods whenever possible.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement