几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 09:08 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how can i insert the serial number note

how can i insert the serial number note?
i would like to create the serial number note, that like the new note insert to the drawing. the first note i can set the start number,next note is serial number .
how can i to wite the marco for serial number note.
the serial number likes the following picture.
sha ,
check this attached macro if it solves your purpose. i have recorded it and then edited the note position.
deepak gupta
sw2007 sp5.0
sw2009 sp2.1
deepak,
thanks for your macro,but i'm sorry,the macro is not i want.
my english is poor,so the purpose is not clearly understood.
my purpose is use the serial number for mark the dimensions.
the max serial number depends on the count of dimensions.
you can set the start number.
to this day,i can use the select point to set the insert position. but it is not best way,i want a more convenient way.
my idea :
i can insert the note and move it with the mouse,then click to set the position,then create new note with the next serial number ......,then press esc key to exit the process, it likes the new note be inserted to the drawing in sw application.
so i must understand that sw note tool is how to insert the notes.
can you solves my purpose?
if you have the other better way , please tell me.
thank you !
edited: 03/23/2009 at 10:14 am by sha zhehua
something like this macro?
dim swapp as sldworks.sldworks
dim swdoc as sldworks.modeldoc2
dim swdwg as sldworks.drawingdoc
dim swview as sldworks.view
dim swdispdim as sldworks.displaydimension
dim swdim as sldworks.dimension
dim scursuffix as string
dim nopenparpos as long
dim ncloseparpos as long
dim vdimval as variant
dim dinchval as double
dim sinchstring as string
dim snewsuffix as string
dim killflag as integer
dim smsg as string
dim srefpfx as string
dim nrefnum as long
dim nstartnum as long
const defsym as string = "c#-"
sub adddimrefnums()
set swapp = application.sldworks
set swdoc = swapp.activedoc
if swdoc.gettype <> swdocdrawing then
msgbox "this macro only works for drawing files."
exit sub
end if
smsg = "this macro will add a symbol containing a dimension reference number " & _
vbcrlf & "to all dimensions in this drawing." & vbcrlf & vbcrlf & _
"to add or update dimension reference symbols, choose ""yes""" & vbcrlf & _
"to remove reference symbols, choose ""no""" & _
vbcrlf & "to quit, choose ""cancel"""
killflag = msgbox(smsg, vbyesnocancel, "dimension reference symbols")
if killflag = vbcancel then
exit sub
end if
if killflag = vbyes then
srefpfx = inputbox("please enter the desired symbol code." & vbcrlf & _
"for example, ""c#-"" for circles, ""s#-"" for squares." & vbcrlf & _
"note that symbol codes are case sensitive.", "symbol type", defsym)
nstartnum = clng(inputbox("enter starting number", "start", 1))
else
srefpfx = ""
end if
set swdwg = swdoc
nrefnum = nstartnum
set swview = swdwg.getfirstview
while not (swview is nothing)
set swdispdim = swview.getfirstdisplaydimension5
while not swdispdim is nothing
set swdim = swdispdim.getdimension
sinchstring = srefpfx & nrefnum
nrefnum = nrefnum + 1
scursuffix = swdispdim.gettext(swdimensiontextsuffix)
nopenparpos = instr(1, scursuffix, "<", vbtextcompare)
ncloseparpos = instr(1, scursuffix, ">", vbtextcompare)
if (killflag = vbno) and (nopenparpos > 0) and (ncloseparpos > 0) then
snewsuffix = left(scursuffix, nopenparpos - 1)
snewsuffix = snewsuffix & right(scursuffix, len(scursuffix) - ncloseparpos)
elseif (nopenparpos > 0) and (ncloseparpos > 0) then
snewsuffix = left(scursuffix, nopenparpos)
snewsuffix = snewsuffix & sinchstring
snewsuffix = snewsuffix & right(scursuffix, len(scursuffix) - (ncloseparpos - 1))
else
if killflag <> vbno then
snewsuffix = trim(scursuffix) & " <" & sinchstring & ">"
else
snewsuffix = scursuffix
end if
end if
swdispdim.settext swdimensiontextsuffix, snewsuffix
set swdispdim = swdispdim.getnext5
wend
set swview = swview.getnextview
wend
end sub
i'll get you eh steve, if it's the last thing i dooooo!
josh,
thanks for your macro. i was glad to tested your macro, it is a good way of my purpose,
but i also have some programs.
1. in position the nearly number is too far, it's difficult to find the next number.
i don't know the order of the number's position.
the order i hope is top-left-down-right. look at the attachment of order.
2. the number must be less than 100, if not ,the display is error.
3. the same number appeared.
4. if i want to insert number for a part of dimensions , how can i do?
the comment has changed, please see it again.
edited: 03/24/2009 at 03:31 am by sha zhehua
click for full image
answer try this one. run the macro and a form will pop up. you can choose from circle, triangle, or square symbols. the number in the text box is the next symbol number. every time you click on a dimension it will put the number from the box in as a symbol, then increment the number. if the "delete" box is checked, it will delete the symbol from each dimension you click.
i'll get you eh steve, if it's the last thing i dooooo!
josh,
thanks for your good macro, it realized my purpose basically.
but, the number must less than 100, that is the last problem , is't very important.
i must add the symbol in symbols library file for the number, that is a troublesome thing, and the other sw users can not use the symbol before they get the symbol file.
so i can't use the symbol for the number, i try to use the note for the number,that is my first idea. i will try to edit your macro for insert the note when select proint.
just now i have new ideas. i will retain your idea, and add my idea in marco.
you can choose the both of way to insert number , if the number is less than 100,then you can choose the symbol way ;if the number is more than 99 ,then you can choose the note way.
i think that is the better way.
your fast reply, thank you very much!
edited: 03/25/2009 at 12:56 am by sha zhehua
if you can use the native sw dim naming, all dims are currently numbered. you can just turn number description on in the options.
matt lorono
solidworks 2007 sp3.1
cad engineer/ecn analyst
hi matthew,
i don't know where is the number description about your said in the sw options,
i think you said is "show dimension's names", it's right?
but that can not realize to my purpose , there is some problem.
1. when i insert the dim for design model, usually i don't consider the order of the dim.
2. there is the same name of dim in the different sketch,
without the reference dimensions,through you can use the number to rename each dim, that is a troublesome thing.
3. you can't set the position of the dim's name in display, adjust the position of
each dim is a troublesome thing.
thanks.
edited: 03/26/2009 at 08:09 am by sha zhehua
hi
to this day, i have realized my mind with your help.
i have sent the answer to josh .
and the last macro interface is in the attachment , please have a look.
thank you very much.
click for full image
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
Unicode、UCS、UTF、BMP、BOM huangyhg vc编程 2 2007-01-22 05:43 PM
En 14350-1:2004 (e) huangyhg ISO standards 0 2006-12-02 04:36 PM


所有的时间均为北京时间。 现在的时间是 08:45 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多