![]() |
【转帖】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 |
所有的时间均为北京时间。 现在的时间是 04:32 PM. |