几何尺寸与公差论坛

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

【转帖】drawing view placements

[复制链接]
发表于 2009-4-13 10:35:02 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 23:06 , Processed in 0.036918 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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