|
using enum to turn off modify dimension box
hi,
i have created a macro to create a hole in a part. however, the macro stops everytime a dimension is added to the hole as the modify dimension box appears.
i know that turning off "input dimension value" system setting solves this problem but i want to be able to turn off this feature only when the macro is running.
so far i am trying:
public enum swuserpreferencetoggle_e
swinputdimvaloncreate = 1
end enum
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
set swselmgr = part.selectionmanager
set swmodext = part.extension
swapp.setuserpreferencetoggle swinputdimvaloncreate, false
i get no error message but it does not change the system value.
i saw that sldworks::setuserpreferencetoggle is void in the api. is that the problem? i have a feeling it is that i don't understand how to enumerate parameters.
also, a general follow up question. how are the numbers picked when enumerating lists of only one or two settings? in api example there is sometimes only one item in the list but it might be set to 18, for example.
thanks for any help.
assuming you are using sw > 2005 or so, all of those enums are automatically included by default when you edit a macro. they are in the solidworks 200x constants type library. what you are doing when you add
public enum swuserpreferencetoggle_e
swinputdimvaloncreate = 1
end enum
is you are overriding the enumeration that is already included in your project! get rid of that enumeration and your code should work fine. if you'll type "swinputdimvaloncreate" all in lower case and then move the cursor away from the line, the vba editor will change it to the proper capitalization. that's how you can know that vba already knows what the value of that constant is supposed to be. by the way, by adding that enumeration at the top, you are saying that swinputdimvaloncreate is equal to 1. this is not the case. the correct value for that constant is 10. by using 1 instead, you are actually toggling display of arc center points (swdisplayarccenterpoints).
a lot of the examples in the help were created before swconst.tlb was included by default with all macros, so they include an abbreviated enum at the beginning just using the values that will be used in the code. however, swconst pretty much includes every single enum and constant listed in the help.
i'll get you eh steve, if it's the last thing i dooooo!
hi josh,
when i stopped using the enumeration state, it worked.
just the statement
swapp.setuserpreferencetoggle swinputdimvaloncreate, false
is all i needed.
i looked in the object browser and found the constants library, thanks.
if i did an enumeration with 10, what would happen (i suppose i'll try this)? i am still unclear if it would turn it on or off.
quick |
|