API: Bitwise Options

Alright, I give. I have a macro that pulls up a drawing and performs various operations and everything works great, except I want to rebuild the views that are not up to date. I'm trying to use "ModelDoc.Rebuild ( Options )", but I can't seem to get the bitwise options right. I've declared them, I think properly according to an example I've found:

... Const swRebuildAll = &H1 Const swForceRebuildAll = &H2 Const swUpdateMates = &H4 Const swCurrentSheetDisp = &H8 Const swUpdateDirtyOnly = &H10 ...

And used this:

... Rebuild = DrawingDoc.Rebuild(options) ...

But, I've tried any number of different formats for the "options" variable; decimal, binary, hex, even the option name, but the most I get is some sort of partial rebuild where it seems to rebuild, but the object lines disappear. I'd prefer to update only those marked as needing it - swUpdateDirtyOnly. ???

TIA,

Dave

Reply to
Dave L
Loading thread data ...

If you check the swconst.bas file, you will find these listed so you can verify the proper declarations. If you are trying to use more than one of these, you need to use the bitwise AND to put the bit flags together.

Best Regards,

Reply to
Robert V. Hanson

Sorry, but this has to be a mistake; you need to use bitwise OR to put the flags together. Most usually SW constants are of type long. Bitwise AND is for testing, OR is for setting flags - this may, for sure, be confusing. A good rule of thumb for bitwise operations: if it seems logical, it is propably wrong. ;-) . So it should work by callig for example

Const swForceRebuildAll as Long = &H2 Const swUpdateDirtyOnly as Long = &H10 .... Rebuild = DrawingDoc.Rebuild(swForceRebuildAll Or swUpdateDirtyOnly)

Hope this helps!

-h-

Reply to
Heikki Leivo

Thanks guys. I don't get any error, but it still doesn't update the views. I've actrually tried the exact syntax shown below before with no luck and I've tried AND. Oddly, the only option that seems to do anything is "swCurrentSheetDisp". All the object lines diappear. None of the other options seem to do anything.

Thanks again, Dave

Reply to
Dave L

im thinking this could be the problem. because microsoft controls the repainting of the screen. you may need to use this command. View::UpdateViewDisplayGeometry

Reply to
Sean Phillips

I don't know if this makes it more intuitive, but you could use the "+" as your "OR" operator. i.e., DrawingDoc.Rebuild(swForceRebuildAll + swUpdateDirtyOnly)

One way of thinking about this is by way of a search engine analogy. If you search for "A or B" you get documents that contain "A"; you also get documents that contain "B". So the "OR" gives you BOTH document sets. In this case, the "OR" gives you both options.

For what it's worth, Brenda

----------------------------------------------- Brenda D. Bosley, PE CustomSolids

Reply to
Brenda D. Bosley

Dave,

A couple other things to check...

  1. Not all options are valid, depending on your Document type. The help file has a chart on this.
  2. The other thing I just noticed is that you're trying to get a return value off of the API call, and there is none for this one (assuming you're using VB, which it looks like from your sample lines) In other words, the call should just be

DrawingDoc.Rebuild(swForceRebuildAll Or swUpdateDirtyOnly)

--Brenda

----------------------------------------------- Brenda D. Bosley, PE CustomSolids

Reply to
Brenda D. Bosley

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.