eddablin Posted April 15, 2009 Share Posted April 15, 2009 Hi. I have a first floor plan of a large building and have drawn beams to the midpoint of columns. Its common practice to have the lines shrunk so it looks like this on plan: I ------- I rather than I----------I It would save me a lot of time if I had a piece of code that made them all scale about their midpoints rather than scale each line by its base points separately. Anyone have a solution? Many thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2009 Share Posted April 15, 2009 How much do you need them scaled by? Are they all on their own layer? Are they lines or Polylines or LWPolylines? Quote Link to comment Share on other sites More sharing options...
eddablin Posted April 15, 2009 Author Share Posted April 15, 2009 How much do you need them scaled by? Are they all on their own layer? Are they lines or Polylines or LWPolylines? Hi Lee. Thanks for the response. They are all lines. Ideally the scale could be user input. If not a scale of 0.8 would be good. Thanks Quote Link to comment Share on other sites More sharing options...
eddablin Posted April 15, 2009 Author Share Posted April 15, 2009 Oh and yes they are all on same layer (called 'Beams') Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2009 Share Posted April 15, 2009 Give this a shot: (defun c:scl (/ ss scl) (vl-load-com) (or scale:def (setq scale:def 0.) (if (setq ss (ssget "X" (list (cons 0 "LINE") (cons 8 "Beams") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (initget 6) (setq scl (getreal (strcat "\nSpecify Scale Factor <" (rtos scale:def) "> : "))) (or (not scl) (setq scale:def scl)) (foreach x (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss))) (vla-ScaleEntity x (vlax-3D-point (vlax-curve-getPointatDist x (/ (vla-get-length x) 2.0))) scale:def))) (princ "\n<!> No Lines Found <!>")) (princ)) Quote Link to comment Share on other sites More sharing options...
eddablin Posted April 15, 2009 Author Share Posted April 15, 2009 Give this a shot: (defun c:scl (/ ss scl) (vl-load-com) (or scale:def (setq scale:def 0.) (if (setq ss (ssget "X" (list (cons 0 "LINE") (cons 8 "Beams") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (initget 6) (setq scl (getreal (strcat "\nSpecify Scale Factor <" (rtos scale:def) "> : "))) (or (not scl) (setq scale:def scl)) (foreach x (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss))) (vla-ScaleEntity x (vlax-3D-point (vlax-curve-getPointatDist x (/ (vla-get-length x) 2.0))) scale:def))) (princ "\n<!> No Lines Found <!>")) (princ)) Worked an absolute treat! I wish I could code these. Would save so much time. Thank you so much! Lifesaver Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2009 Share Posted April 15, 2009 Excellent, glad it met your requirements If you have any other questions about the code or something else, just ask Lee Quote Link to comment Share on other sites More sharing options...
Arizona Posted April 15, 2009 Share Posted April 15, 2009 Lee, that's amazing you through that together so fast. You Are The Man! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2009 Share Posted April 15, 2009 Lee, that's amazing you through that together so fast. You Are The Man! Cheers Dude Quote Link to comment Share on other sites More sharing options...
eddablin Posted April 17, 2009 Author Share Posted April 17, 2009 Hi Lee, One more question: I would like to resize everything on the layer "columns" about its midpoint. These columns are mostly in the form of squares but i think some might have been formed by 4 lines. I tried to edit your code but failed. They just resized about a corner. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 17, 2009 Share Posted April 17, 2009 Hi Lee, One more question: I would like to resize everything on the layer "columns" about its midpoint. These columns are mostly in the form of squares but i think some might have been formed by 4 lines. I tried to edit your code but failed. They just resized about a corner. Thanks in advance My code was only engineered for the initial problem - it was not universal. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 17, 2009 Share Posted April 17, 2009 This will scale the squares with the basepoint at their centres. (defun c:scl (/ ss scl st 3p) (vl-load-com) (or scale:def (setq scale:def 0.) (if (setq ss (ssget (list (cons 0 "*Polyline") (cons 8 "Columns") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (initget 6) (setq scl (getreal (strcat "\nSpecify Scale Factor <" (rtos scale:def) "> : "))) (or (not scl) (setq scale:def scl)) (foreach x (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss))) (setq st (vlax-curve-getStartPoint x) 3p (vlax-curve-getPointatParam x 2.0)) (vla-scaleEntity x (vlax-3D-point (polar st (angle st 3p) (/ (distance st 3p) 2.0))) scale:def))) (princ "\n<!> No Lines Found <!>")) (princ)) It makes a ton of assumptions though - like them being perfectly square, etc Quote Link to comment Share on other sites More sharing options...
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.