Ok I am creating a macro that I would like to wait until the end to rebuild.
I know how to watch for a rebuild event but how do I cancel it out in VBA
SW2003. I could have sworn that somebody mentioned it a few months ago but
the only reference I found was for C++.
Public WithEvents PartEvents As SldWorks.PartDoc
Private Function PartEvents_RegenNotify() As Long
'what goes here to cancel regen
Ok this works, but now it can't get the faces of a new feature that wasn't
rebuilt. I am using the faces to select the body. Do I have to rebuild
inorder to do this or is there some other way. (it was working until I added
the Rebuild interupt.)
"Corey Scheich" a écrit dans le message de
Of course! If the feature wasn't rebuild, its geometry is invalid!
Why do you cancel the rebuild ? I use the trick to speed up the creation of
multiple features in SolidSketch, and some people can use RedLight to avoid
rebuilds while making multiple changes, but in all cases you have to rebuild
the model sooner or later, when you want to access the resulting geometry.
Now there is also a BIG problem related to all this.
SW changed the way rebuilds are done since SW2003. Now, when SW rollbacks to
a state (if you edit a sketch for example), all geometry below this point is
invalidated (including features that do not depend on the modified feature!)
so any Face object you had is likely to be invalid. It *might* be valid
again after a successful rebuild (see Entity::IsSafe).
All this is badly documented, the reason fot his change from SW2001+ is hard
to understand (it causes us big trouble, and I'm convinced it is largely
involved in SW 2003 being slower and less reliable than 2001+), so I'd be
happy if someone could explain me the benefits of the new rebuild
I may be way off base, but I think it has something to do with the faster
rollback and rebuild speeds they advertised when 2003 came out.
After you open a part, then CTRL-Q, you can roll back into the part (make no
changes) and then roll through the features MUCH faster then before because
the features are retained in memory. This is very handy when stepping
through the model. Problem is, if you make a change, everything needs to
So, maybe that "cache" of features in memory cause the behavior you
Yes, that's probably the reason. I agree that rollback with no changes is
significantly faster than before.
I bet it is at expense of memory... However, as others posted here, I didn't
notice faster rebuilds after a change...