几何尺寸与公差论坛------致力于产品几何量公差标准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-13, 10:35 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】drawing view placements

drawing view placements?
i have a drawing view that i am placing in a constant point in a sheet. the view size changes so i use the view.getoutline (obtains the bounding box size of the view) to scale my view so it always fits in the same area. the problem comes that when you scale a drawing, solidworks randomly puts it where ever it wants on the sheet. so i am using the view.position to place the origin of the drawing view (part origin from what i can tell) to the point i want in the middle of the sheet. my x corrdinate works fine but the y corrdinate keeps moving all over the freaking screen, even when setting it, it does not consistantly stay in the same place! it is as bad as the scale feature. has anyone had any experience with this? if so, got a fix or suggestion?
also, i have a note that needs to stay with drawing but for some reason, its realative position on the view gets all funky messed up with the scale and move. all the other dimentions / notes on the view come with it, but these 2 do not...
any ideas would be very helpful!
adam
well, i have figured out the note problem, added some leaders and they follow nicely now.
the y coordinate is still funky. it seems like that when i set the y cord it will randomly chose where to place the drawing. i do not understand why it is doing this... i would like it to always place it in the same spot. here is the code that i am running to make do this, maybe someone can help me with it.
thanks
adam
set drwgview = tubetmpldrwg.getfirstview '*bdb drawing view iteration only around this section now
do until drwgview is nothing
if drwgview.referencedconfiguration <> "" then
if (drwgview.name like "od*" and tubedata.tmpl_od) _
or (drwgview.name like "id*" and tubedata.tmpl_id) then
drwgview.setvisible true, false
'resizes drawing so it is always in a 23.5"x20.25" (wxh) box in the same spot on the drawing...
drwgposition = drwgview.position
drwgposition(0) = 0.6492875 'x position of view on sheet
drwgposition(1) = -0.2794 'y position of view on sheet
boundingbox = drwgview.getoutline
boundingboxw = boundingbox(2) - boundingbox(0)
boundingboxh = boundingbox(3) - boundingbox(1)
if boundingboxh > 0.5588 then
drwgview.scaledecimal = 0.5588 / boundingboxh 'scales view to max height....
'checks to see if width fits on sheet now....
scalecheck = drwgview.scaledecimal * boundingboxw
if boundingboxw > 0.6604 then drwgview.scaledecimal = (0.6604 / boundingboxw) 'scales view to max width....
elseif boundingboxw > 0.6604 then drwgview.scaledecimal = (0.6604 / boundingboxw) 'scales view to max width....
else
drwgview.scaledecimal = 1
end if
if drwgview.scaledecimal <> 1 then drwgview.position = drwgposition 'sets position of scaled view to where unscaled was...
'end of resize of view...
set swdispdim = drwgview.getfirstdisplaydimension5
do until swdispdim is nothing
if swdispdim.gettext(swdimensiontextprefix) like "*ds btw cut*" then
swdispdim.settext swdimensiontextcalloutabove, tubedataentryform.dsbtwcut.text & " ="
end if
set swdispdim = swdispdim.getnext5
loop
else
drwgview.setvisible false, false
end if
end if ' view has model
set drwgview = drwgview.getnextview
loop ' drawing views on current sheet
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】drawing view creation yang686526 SolidWorks二次开发 0 2009-04-13 10:34 AM
【转帖】can you modelize a drawing view yang686526 SolidWorks二次开发 0 2009-04-13 09:31 AM
【转帖】dynamically change the view yang686526 SolidWorks二次开发 0 2009-04-12 08:45 PM
单侧曲面(有趣的麦比乌斯圈)和双侧曲面 cam 图形算法 1 2007-02-26 10:29 PM


所有的时间均为北京时间。 现在的时间是 05:44 PM.


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