几何尺寸与公差论坛

 找回密码
 注册
查看: 889|回复: 0

【转帖】get write access button

[复制链接]
发表于 2009-4-13 11:03:23 | 显示全部楼层 |阅读模式
get write access button
trying to make a button on my toolbar to get write access. every time i open a part now we have it set to open everything read only. i am sick of going "file, get write access". i just want to click a button. i also failed at making a macro for it.
any advice?  
modeldoc2::setreadonlystate
got it working with a easy little button now. i don't know how you knew that. where can i look up stuff like that in the future?

help --> solidworks and addins api help
would you be so kind as to pass the macro on or post how you did it?
we have the same situation everything is read only and we have to change the status if we need to update something.
grant
applications engineer
sw2008 x64 sp 3.1
dell precision t5400
nvidia quadro fx 5600
xeon 2.5ghz quad core, 4gb ram
xp pro x64 sp2.0

^ of course. no problem! i will upload the button i made too
dim swapp as object
dim part as object
dim boolstatus as boolean
dim longstatus as long
dim annotation as object
dim gtol as object
dim datumtag as object
dim featuredata as object
dim feature as object
dim component as object
dim retval as variant
dim readonlystate as boolean 'true= only, false = not
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
readonlystate = part.isopenedreadonly()
if readonlystate = false then readonlystate = true else readonlystate = false
boolstatus = part.setreadonlystate(readonlystate)
end sub
--------------------------------
let me know how it works for you

working great thanks this will help save a few clicks!!
grant
applications engineer
sw2008 x64 sp 3.1
dell precision t5400
nvidia quadro fx 5600
xeon 2.5ghz quad core, 4gb ram
xp pro x64 sp2.0

why are you required to open read only? company policy?  be careful that you are not gaining write access to a file someone else has open read/write.
^ yep. my policy.
we had "employee a" open an assembly. that assembly contained a part that "employee b" had open. employee b would make a change to the part and save it. employee a had write access to it in the assembly, when he would save it it would over write what b did.
now, everything is set to open read only. if you want w/a to it, you have to ask for it. if someone else already has w/a to it, it tells you the name of the person who has write access.
made the change a year ago after problem after problem. now, not a single problem since.
we have no pdm.  
articcatmatt,
  i do not see how a person opening an assembly that contains a read only file (open on another machine) could be able to overwrite it.  windows locks the file whenever someone opens it.  is your server non-windows?  we do not use pdm, and have done extensive checking that once a user has read/write permissions, no one else can write, until it is suppressed and the assembly is saved so someone else can grab it.
gerald
^ i don't know how to explain it.
someone would open something and it would be read only. someone else would open it read only and get write access, make a change, and save. the original person still had it on their scree in the old state and would get write access and save it, thus overwriting the changes the second person made.
thats the best i can explain it.
making everything default open to read only fixed the problem. been that way for 2 years now. i tested it with it off and on and the only way to avoid it was to have it on.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 18:28 , Processed in 0.036972 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表