brawleyman Posted May 30, 2012 Posted May 30, 2012 I created a LISP routine that will search for all blocks in model space and scale them up or down with the dimscale from the block insertion point. However, I have polylines in between some of those blocks that I need to scale with the blocks from their midpoint then trim them down. My goal with this routine is that after we have designed a system with these blocks and we find out that we need a different scale, we can run this routine to scale everything to the new scale (ie design everything in 1/8", but need to change to 3/32"). I need to find a way to scale all polylines from their midpoint, then shorten them back so they look correct. All polylines needed to scale are on the same layer, SPRKVIEW, but may be different colors or linetypes. Here is a picture with 3 lines. Top line is original in 1/8", 2nd line shows everything scaled up to 1/16" from their midpoint, then bottom line shows what it should look like after the routine is finished and plines shortened. Quote
Tharwat Posted May 30, 2012 Posted May 30, 2012 I think changing the constant width of the polyline would solve the issue without scaling it . Quote
brawleyman Posted May 30, 2012 Author Posted May 30, 2012 Are the blocks Annotative brawleman? I don't believe so. There are standard blocks and ones with attributes in them. If you look at the picture I attached, the length of the pline between blocks in the top drawing and bottom drawing are different (3/32 version is shorter than 1/8" because block is bigger). I just need a way to scale all plines from their midpoint, then shorten them up to coincide with the new block size. Everything is based on 1/8" standard scale, so blocks measure 12". Quote
pBe Posted May 30, 2012 Posted May 30, 2012 So you scale the block by a factor depending on the desired scale? I would suggest you start using annotative, that will be two less entity to worry about. But since you already have those drawings , we just have to do a work around then. on your current code. does it prompt for scale? Preferably there should be a variable to indicate what scale it was before with regards to the new scale. Working with annotative, you have a basis for what was and what will be --> 'cannoscale. Are those polylines between the blocks never more than two points? Quote
brawleyman Posted May 30, 2012 Author Posted May 30, 2012 So you scale the block by a factor depending on the desired scale? I would suggest you start using annotative, that will be two less entity to worry about.But since you already have those drawings , we just have to do a work around then. on your current code. does it prompt for scale? Preferably there should be a variable to indicate what scale it was before with regards to the new scale. Working with annotative, you have a basis for what was and what will be --> 'cannoscale. Are those polylines between the blocks never more than two points? I am working with HydraCAD and I am just having to work with what they have set up. Basically they treat 1/8" scale as 1=1 or the base scale (block inserted with scale of 1 measures 12" as if in 1/8" scale in a viewport). I have code setup with a prompt window that has a pull down to pick what scale you want to set the drawing to and a line showing what the current scale of the drawing is. There is also a button that you can click on showing what the current drawing scale is, what space you are in (model or paper) and who edited the drawing last and when. The drawing scale part is good to go, and another piece of code scales all of my blocks up or down to whatever scale I want, I just need a way to scale the plines and shorten them up to coincide with the different size blocks. All plines are just one piece with 2 points. Quote
pBe Posted May 30, 2012 Posted May 30, 2012 I am working with HydraCAD and I am just having to work with what they have set up.... Oops, forget about what i just said. I gues i would approach it this way. scale down (not up) the pline then change the wdith. Are the scales always by a factor of 2? EDIT: its getting pretty late here brawleyman, i'll check up on this thread tommorrow. Quote
brawleyman Posted May 30, 2012 Author Posted May 30, 2012 (edited) Oops, forget about what i just said. I gues i would approach it this way. scale down (not up) the pline then change the wdith. Are the scales always by a factor of 2? Basically, everything is based on the dimscale, that is how everything is inserted, including from my code and the tool palette where we have all of our standard sprinkler heads and notes, etc. Dimscale of 1 sets the blocks to a scale of 1, which is the same as 1/8" scale in the viewports, which is the size needed when plotting out our drawings to scale (3/32" is dimscale 1.33, 1/16" scale is dimscale 2, 3/16" scale is dimscale .667, etc.). The width of the plines is fine because as the pipe dimensions scale, the space between the text changes and the pline width fits just fine. I just need to be able to select all plines making the "pretty pipe", scale from their midpoint, then shorten them up from the ends to match where the new border of the sprinkler heads are. I hope this answers things better. The way everything works is basically a manual version of what annotation scale does, so if you had to show different dimensions for the same area, you would have dimensions on different layers for each scale and just freeze what you don't need in the viewports, although we don't have to do that for our purposes. We always have an overall plan that can be different scales, then enlarged plans of different areas that are always the same scale for a particular project. ***EDIT*** Thanks pBe for your help. I know it is kind of confusing what is needed and how things are setup, but just think of it as manual scaling of the drawing and everything in it. We use bases from the architect xref'd into an FP Master file so we can put our work on top of the Architectural background, then that file is xref'ed into drawings with our sheets (one drawing file per sheet instead of one file with multiple tabs/sheets. I know what you are thinking, but I am in an Architectural/Engineering Firm and that is how everything is setup) Edited May 30, 2012 by brawleyman Quote
brawleyman Posted May 30, 2012 Author Posted May 30, 2012 I think changing the constant width of the polyline would solve the issue without scaling it . That isn't the issue I am having, it is the LENGTH of the line that has to be adjusted because of the new size of the blocks as you can see in the picture at the top. HydraCAD has a program you can run called "Pretty Pipe" that makes a copy of all of the construction lines (yellow line in picture), turns the copies into plines with a specified width, then shortens them up to match the heads. The picture at the top has a yellow line going from center to center of the blocks, which is where you get your pipe length, that layer disappears when you are in paper space so that just the "pretty pipe" shows for clarity when you plot the drawings. The issue is that when the heads are scaled to a different size, the pretty pipe stays the same length, but as you can imagine, there would then be a gap between the heads and pipe if scaled smaller or overlap if scaled bigger. Quote
Lee Mac Posted May 30, 2012 Posted May 30, 2012 To offer an alternative, perhaps scale your circles, then use something like this to construct the intermittent lines: [color=GREEN];; Connect Circles - Lee Mac 2012[/color] [color=GREEN];; Constructs lines to connect a set of circles using the shortest line[/color] [color=GREEN];; at each iteration (Variation of Shortest Path Problem).[/color] [color=GREEN];; Implements a non-optimal greedy algorithm.[/color] ([color=BLUE]defun[/color] c:cc ( [color=BLUE]/[/color] c d e i l m n s z ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] '((0 . [color=MAROON]"CIRCLE"[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s)) ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i)))) l ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 e)) ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 40 e))) l) ) ) ([color=BLUE]setq[/color] m ([color=BLUE]distance[/color] ([color=BLUE]caar[/color] l) ([color=BLUE]caadr[/color] l)) c ([color=BLUE]car[/color] l) ) ([color=BLUE]foreach[/color] x ([color=BLUE]setq[/color] z l) ([color=BLUE]foreach[/color] y ([color=BLUE]setq[/color] z ([color=BLUE]cdr[/color] z)) ([color=BLUE]if[/color] ([color=BLUE]<[/color] m ([color=BLUE]setq[/color] n ([color=BLUE]distance[/color] ([color=BLUE]car[/color] x) ([color=BLUE]car[/color] y)))) ([color=BLUE]setq[/color] m n c x) ) ) ) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] l ([color=BLUE]vl-remove[/color] c l)) ([color=BLUE]setq[/color] m ([color=BLUE]distance[/color] ([color=BLUE]car[/color] c) ([color=BLUE]caar[/color] l)) d ([color=BLUE]car[/color] l) ) ([color=BLUE]foreach[/color] x ([color=BLUE]cdr[/color] l) ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]setq[/color] n ([color=BLUE]distance[/color] ([color=BLUE]car[/color] x) ([color=BLUE]car[/color] c))) m) ([color=BLUE]setq[/color] m n d x) ) ) ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 10 ([color=BLUE]polar[/color] ([color=BLUE]car[/color] c) ([color=BLUE]angle[/color] ([color=BLUE]car[/color] c) ([color=BLUE]car[/color] d)) ([color=BLUE]cadr[/color] c))) ([color=BLUE]cons[/color] 11 ([color=BLUE]polar[/color] ([color=BLUE]car[/color] d) ([color=BLUE]angle[/color] ([color=BLUE]car[/color] d) ([color=BLUE]car[/color] c)) ([color=BLUE]cadr[/color] d))) ) ) ([color=BLUE]setq[/color] c d) ) ) ) ([color=BLUE]princ[/color]) ) Quote
brawleyman Posted May 30, 2012 Author Posted May 30, 2012 To offer an alternative, perhaps scale your circles, then use something like this to construct the intermittent lines: [ATTACH]35067[/ATTACH] [color=GREEN];; Connect Circles - Lee Mac 2012[/color] [color=GREEN];; Constructs lines to connect a set of circles using the shortest line[/color] [color=GREEN];; at each iteration (Variation of Shortest Path Problem).[/color] [color=GREEN];; Implements a non-optimal greedy algorithm.[/color] ([color=BLUE]defun[/color] c:cc ( [color=BLUE]/[/color] c d e i l m n s z ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] '((0 . [color=MAROON]"CIRCLE"[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s)) ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i)))) l ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 e)) ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 40 e))) l) ) ) ([color=BLUE]setq[/color] m ([color=BLUE]distance[/color] ([color=BLUE]caar[/color] l) ([color=BLUE]caadr[/color] l)) c ([color=BLUE]car[/color] l) ) ([color=BLUE]foreach[/color] x ([color=BLUE]setq[/color] z l) ([color=BLUE]foreach[/color] y ([color=BLUE]setq[/color] z ([color=BLUE]cdr[/color] z)) ([color=BLUE]if[/color] ([color=BLUE]<[/color] m ([color=BLUE]setq[/color] n ([color=BLUE]distance[/color] ([color=BLUE]car[/color] x) ([color=BLUE]car[/color] y)))) ([color=BLUE]setq[/color] m n c x) ) ) ) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] l ([color=BLUE]vl-remove[/color] c l)) ([color=BLUE]setq[/color] m ([color=BLUE]distance[/color] ([color=BLUE]car[/color] c) ([color=BLUE]caar[/color] l)) d ([color=BLUE]car[/color] l) ) ([color=BLUE]foreach[/color] x ([color=BLUE]cdr[/color] l) ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]setq[/color] n ([color=BLUE]distance[/color] ([color=BLUE]car[/color] x) ([color=BLUE]car[/color] c))) m) ([color=BLUE]setq[/color] m n d x) ) ) ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 10 ([color=BLUE]polar[/color] ([color=BLUE]car[/color] c) ([color=BLUE]angle[/color] ([color=BLUE]car[/color] c) ([color=BLUE]car[/color] d)) ([color=BLUE]cadr[/color] c))) ([color=BLUE]cons[/color] 11 ([color=BLUE]polar[/color] ([color=BLUE]car[/color] d) ([color=BLUE]angle[/color] ([color=BLUE]car[/color] d) ([color=BLUE]car[/color] c)) ([color=BLUE]cadr[/color] d))) ) ) ([color=BLUE]setq[/color] c d) ) ) ) ([color=BLUE]princ[/color]) ) Thanks for the alternative method Lee Mac, but I am dealing with Sprinkler Heads, which have to be in defined locations and pipe has to run between them in specified ways. The yellow/blue line is like a construction line used to "link" the heads together which gives you the pipe length. The "pretty pipe" is just a way to clean up and show the heads with pipe in between with clarity. Here is an example of what I see in Model Space, looks the same in Paper space just without the yellow and blue lines. ***EDIT*** The pretty pipe has to be made with HydraCAD's program. I just need a way to select all of the plines and scale them from their midpoint, then shorten the ends to match the outside of the sprinkler heads. Quote
pBe Posted May 31, 2012 Posted May 31, 2012 (edited) Test this on the attached drawing and see if thats how you want it to work on your drawing (defun c:mit (/ _LockorXref _pledit _carcadr approvedscales scale pscale nscale ent typ pl plt) (vl-load-com) [color=blue](defun _LockorXref (table / a b)[/color] [color=blue] (setq b "")[/color] [color=blue] (while (setq a (tblnext table (null a)))[/color] [color=blue] (if (= 4 (logand 4 (cdr (assoc 70 a))))[/color] [color=blue] (setq b (strcat b (cdr (assoc 2 a)) ","))[/color] [color=blue] )[/color] [color=blue] ) b[/color] ) (defun _pledit (ex ne e / ext) [color=blue](setq ext (abs (- (cadr ex)(cadr ne))))[/color] (if (< (car ex) (car ne)) (append (_carcadr (vlax-curve-getPointAtDist e ext)) (_carcadr (vlax-curve-getPointAtDist e (- (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)) ext)))) (progn (setq ang (angle (setq sp (vlax-curve-getStartPoint e)) (setq ep (vlax-curve-getEndPoint e)))) (append (_carcadr (polar sp (+ ang pi) ext)) (_carcadr (polar ep ang ext)))) ) ) (setq [color=blue]approvedscales[/color] [color=blue] '((0.125 -5.25) (0.25 -4.5) (0.333 -4.002)(0.5 -3.0) (0.667 -1.98) (1.00 0.00) (1.25 1.50)[/color] [color=blue] (1.33 1.98) (2.00 6.0) (2.5 9.0) (3.75 16.50) (5.00 24.0) (6.25 31.50) (7.5 39.0)[/color] [color=blue] (8.75 46.50) (10 54.0) (11.25 61.50) (12.5 69.0)[/color] [color=blue] )[/color] _carcadr (lambda (x) (list (car x) (cadr x))) pscale nil) (if (and [color=blue](setq scale (getvar 'dimscale))[/color] [color=blue] (assoc scale approvedscales)[/color] (setq pl (ssadd) ss [color=blue](ssget "_X"[/color] [color=blue] (list[/color] [color=blue] '(-4 . "<or")[/color] [color=blue] '(-4 . "<AND")'(0 . "INSERT")[/color] [color=blue] '(-4 . "<not") (cons 8 (_LockorXref "LAYER" )) '(-4 . "not>")[/color] [color=blue] '(-4 . "<not") (cons 2 (_LockorXref "BLOCK" )) '(-4 . "not>")[/color] [color=blue] '(-4 . "AND>")[/color] [color=blue] '(-4 . "<AND") '(0 . "LWPOLYLINE") '(8 . "SPRKVIEW")[/color] [color=blue] '(-4 . "AND>") '(-4 . "OR>"))[/color] [color=blue] )[/color] )) (progn (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i)))) (cond ((eq (setq typ (cdr (assoc 0 (entget ent)))) "INSERT") (if (null pscale) (setq pscale (abs (cdr (assoc 41 (entget ent)))))) (mapcar '(lambda (j) (vlax-put (vlax-ename->vla-object ent) j scale)) '("XScaleFactor" "YScaleFactor" "ZScaleFactor")) ) ((eq typ "LWPOLYLINE") (setq pl (ssadd ent pl))))) (if (and pscale (ssname pl 0)) (progn [color=blue](setq pscale (assoc pscale approvedscales))[/color] [color=blue] (setq nscale (assoc scale approvedscales))[/color] (repeat (sslength pl) (setq plt (vlax-ename->vla-object (setq e_ (ssname pl 0)))) (vla-put-ConstantWidth plt (* scale 2.0)) [b][color=blue] (if (car (setq cord (_pledit pscale nscale e_))) (vlax-put plt 'coordinates cord))[/color][/b] (ssdel (ssname pl 0) pl)) ) ) ) ) (princ) ) Need to "fix" the width assignment later. I need a baseline width for the pline. now its 2.0 EDIT: change the width of the polylines on the attached drawing to see the effect. [needs refinement , maybe later when the OP decides to go with this] EDIT: CODE Updated [09June2012] Exclude Locked layers AND/OR Xref. Add values for Pline Extend/Trim value sample.dwg Edited June 9, 2012 by pBe ooops Quote
brawleyman Posted June 5, 2012 Author Posted June 5, 2012 Hey, sorry guys! I was out of town all weekend, but now I am back at work to test this out from pBe. I just loaded it up but it says "Error: Parameter no optional". Not sure what it is that is keeping it from loading... Quote
pBe Posted June 5, 2012 Posted June 5, 2012 Hey, sorry guys! I was out of town all weekend, but now I am back at work to test this out from pBe. I just loaded it up but it says "Error: Parameter no optional". Not sure what it is that is keeping it from loading... Apologies brawleyman, got all the codes mix-up with another routine i'm writing back then... the code above works on the drawing sample i posted. Assuming these following numbers are the dimscale you're using . 0.67 1.00 1.33 2.00 so when you're testingthe code. use either of those numbers HTH Quote
brawleyman Posted June 5, 2012 Author Posted June 5, 2012 (edited) Apologies brawleyman, got all the codes mix-up with another routine i'm writing back then... the code above works on the drawing sample i posted.Assuming these following numbers are the dimscale you're using . 0.67 1.00 1.33 2.00 so when you're testingthe code. use either of those numbers HTH That works pretty good! However, it doesn't cover all of the scales I am using, especially when it scales the plines, they become shorter when I choose .5 dimscale for example. Here is a snippet of my code that looks for the dimscale and assigns a variable. ;; ;;-------------getdrawingscale---------------;; ;; (defun getdrawingscale () (if (= (getvar "dimscale") 2) (setq thehfscale "1/16")) (if (= (getvar "dimscale") 1.333) (setq thehfscale "3/32")) (if (= (getvar "dimscale") 1) (setq thehfscale "1/8")) (if (= (getvar "dimscale") 0.667) (setq thehfscale "3/16")) (if (= (getvar "dimscale") 0.5) (setq thehfscale "1/4")) (if (= (getvar "dimscale") 0.333) (setq thehfscale "3/8")) (if (= (getvar "dimscale") 0.25) (setq thehfscale "1/2")) (if (= (getvar "dimscale") 0.125) (setq thehfscale "1/1")) (if (= (getvar "dimscale") 1.25) (setq thehfscale "1/10'")) (if (= (getvar "dimscale") 2.5) (setq thehfscale "1/20'")) (if (= (getvar "dimscale") 3.75) (setq thehfscale "1/30'")) (if (= (getvar "dimscale") 5) (setq thehfscale "1/40'")) (if (= (getvar "dimscale") 6.25) (setq thehfscale "1/50'")) (if (= (getvar "dimscale") 7.5) (setq thehfscale "1/60'")) (if (= (getvar "dimscale") 8.75) (setq thehfscale "1/70'")) (if (= (getvar "dimscale") 10) (setq thehfscale "1/80'")) (if (= (getvar "dimscale") 11.25) (setq thehfscale "1/90'")) (if (= (getvar "dimscale") 12.5) (setq thehfscale "1/100'")) (setq approvedscales '(0.125 0.25 0.333 0.5 0.667 1 1.33 2 1.25 2.5 3.75 5 6.25 7.5 8.75 10 11.25 12.5)) (if (not (member (getvar "dimscale") approvedscales)) (progn (alert "No usable scale has been detected in this drawing!\nThis drawing has been set to the default 1/8\" scale.") (setq thehfscale "1/8") );end progn );end if );end defun These are the only scales we use for our work. Here you can see all of the dimscales we use. Also, the program that I am working on should select all blocks in model space and scale them, but I can easily change the code to select all of them instead of just the one block. ***EDIT*** Oh, and I am not sure where you would put it in the code or what you would change, but there are 2 different widths we deal with on the plines. Branch lines are 2.5" and Mains are 3.5" in 1/8" scale. Also, where these blocks are being changed (model space) there are also x-ref's on a locked layer, so that should probably need to be incorporated somehow too. Edited June 5, 2012 by brawleyman Quote
pBe Posted June 6, 2012 Posted June 6, 2012 That works pretty good! However, it doesn't cover all of the scales I am using, especially when it scales the plines, they become shorter when I choose .5 dimscale for example. Here is a snippet of my code that looks for the dimscale and assigns a variable......... These are the only scales we use for our work. Here you can see all of the dimscales we use. Also, the program that I am working on should select all blocks in model space and scale them, but I can easily change the code to select all of them instead of just the one block. Check. ***EDIT*** Oh, and I am not sure where you would put it in the code or what you would change, but there are 2 different widths we deal with on the plines. Branch lines are 2.5" and Mains are 3.5" in 1/8" scale. Also, where these blocks are being changed (model space) there are also x-ref's on a locked layer, so that should probably need to be incorporated somehow too. I can show the where and what brawleyman, the width is no biggie, what i dont understand is the reference to XREF objects, Do you want the blocks on the xrefed file to update as well? now that will be a handfull , [i'm more inlcined to use annotative blocks in this case, where even XREF is updated right then and there] BUT you mentioned before the software you are using doesnt have that capability. Can you give more info regarding that issue? Quote
brawleyman Posted June 6, 2012 Author Posted June 6, 2012 Check. I can show the where and what brawleyman, the width is no biggie, what i dont understand is the reference to XREF objects, Do you want the blocks on the xrefed file to update as well? now that will be a handfull , [i'm more inlcined to use annotative blocks in this case, where even XREF is updated right then and there] BUT you mentioned before the software you are using doesnt have that capability. Can you give more info regarding that issue? Oh, no no no. Sorry if I sounded confusing. I just meant that I also have X-Ref's in the same space as where the blocks are being changed. I tried changing the code slightly so that it wouldn't just look for the "BLOCK1" insert, but everything in model space that is an insert. When I tried running the routine it was picking up on the xref and saying that an object was on a locked layer and wouldn't finish the routine. Basically, I need it to find and scale ANY blocks in model space that are actually in the drawing (not in xref's). Quote
irneb Posted June 6, 2012 Posted June 6, 2012 How are you selecting the blocks? Using ssget? Are you only working with DXF values or also VLA methods? Sorry, you've not posted any code - so there's quite a few alternatives I could throw at you, many might be inefficient though (depending on your code). Edit: Sorry I'm blind today , you're using pBe's code. The "easiest" way might be to use ssget's ":L" option to disallow selection of entities on locked layers. Otherwise you need to check the block definitions to find out if they're xrefs (e.g. the definitions code 1 would have a path, the vla object has a IsXref property). I think the most efficient way might be to generate a list of block names which aren't xrefs (by going through the block definition table vla-get-Blocks of active document, or tblnext). Then combine that into a comma seperated string for inclusion in ssget's filter list. That way you only need to check each block definition once. If you check inside the loop after selecting, you'll check the same definition multiple times. Quote
brawleyman Posted June 6, 2012 Author Posted June 6, 2012 How are you selecting the blocks? Using ssget? Are you only working with DXF values or also VLA methods? Sorry, you've not posted any code - so there's quite a few alternatives I could throw at you, many might be inefficient though (depending on your code). Edit: Sorry I'm blind today , you're using pBe's code. The "easiest" way might be to use ssget's ":L" option to disallow selection of entities on locked layers. Otherwise you need to check the block definitions to find out if they're xrefs (e.g. the definitions code 1 would have a path, the vla object has a IsXref property). I think the most efficient way might be to generate a list of block names which aren't xrefs (by going through the block definition table vla-get-Blocks of active document, or tblnext). Then combine that into a comma seperated string for inclusion in ssget's filter list. That way you only need to check each block definition once. If you check inside the loop after selecting, you'll check the same definition multiple times. I looked into ":L", but then I would have to drag a window around everything to select my blocks and such. I want it to be able to just select everything for me. I tried combining "_X:L" and a few other combinations, but I guess ssget filters don't allow that setup. Ultimately, my master code will work in such a way that anytime I need to change the scale of a drawing (ie draw everything to 1/8" originally, but the sheets end up needing to be 3/32", I can just change the scale of the drawing and it will scale everything for me automatically), everything gets updated to the new scale with one click. Currently, everything is based around dimscale. When you change the dimscale, it sets the fillet radius and lts. Since I know that dimscale is a constant value saved next time you open the drawing, I have it setup so that when you open the drawing, it reads the dimscale then sets my variables for thehfscale, lts, filletrad, and some other custom variables. I really like pBe's code, I just need a few adjustments to it to work the way I need it to. Find and scale ALL blocks and plines on a particular layer in model space to any of the listed approved scales I have above. Right now, the scaling of the plines doesn't work on every scale, but not sure why. Quote
pBe Posted June 6, 2012 Posted June 6, 2012 (edited) I will look into it brawleyman, dont have CAD with me right now, question though, if the routine is not limited to a specific block.... (block inserted with scale of 1 measures 12" as if in 1/8" scale in a viewport). That statement wont be applicable anymore? or the rest of the blocks are the same size as the orignal block (in terms of geometry i mean), if not we may have to use a different approach, as the previous code will compute the length of the pline with a specific increment (by a factor of 1.98 ) based on a 12" block. Edited June 7, 2012 by pBe Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.