VBA: STOP REBUILD

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 End Function

Thanks, Corey Scheich

Reply to
Corey Scheich
Loading thread data ...

Was the solution to hit CTRL-Break?

Mike Wilson

Reply to
Mike J. Wilson

if RegenNortify returns 1 instead of 0, the rebuild will be cancelled. Check

formatting link
for a free add-in based on this.

Reply to
Philippe Guglielmetti

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

Reply to
Corey Scheich

"Corey Scheich" a écrit dans le message de news:bn8nl8$ui0rs$ snipped-for-privacy@ID-200385.news.uni-berlin.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 strategy...

Reply to
Philippe Guglielmetti

Philippe...

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 rebuild normally.

So, maybe that "cache" of features in memory cause the behavior you describe?

Todd

Reply to
Todd

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...

Reply to
Philippe Guglielmetti

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.