Hsanon Posted April 4, 2016 Posted April 4, 2016 Hi, our approval process requires our car blocks to be converted to rectangles of various colour & lineweight & layer . These changes whether the car block is under building stilt cover or in the open, in basement or above ground floor, and whether the car block is single or multilevel (two level). When we place the car blocks during the course of design, they are rotated / mirrored / placed at all angles etc... and its difficult for me (with my limited autolisp experience & nil visual lisp experience) to filter our the correct blocks & figure out which way it is facing. and then draw rectangles with the correct colour and lineweight any suggestions / support please ?? have attached a sample drawing to give clarity for my problem parking small.dwg Quote
BIGAL Posted April 5, 2016 Posted April 5, 2016 I think more importantly before drawing make the correct assumption of which block to use rather than after. A diffrent tact maybe bring your car blocks in on correct layer from another drawing and place near then just use copy or change properties erase after use. We have this in our DWT. Use a menu option tool palette and pick correct block maybe a lisp for rotate 90 repeatedly etc. Quote
Hsanon Posted April 5, 2016 Author Posted April 5, 2016 Thanks Bigal I was thinking more like LeeMac's OutlineObjects..... where in the larger selection, we can filter out the car blocks (yes we can use different blocks for cars under cover / cars outside stilt etc.) And have a program to wrap the rectangle around it (with right layer / colour / lineweight) Possible ???? Quote
danellis Posted April 5, 2016 Posted April 5, 2016 Redefine your blocks in one of two ways: 1) Add your "approved" rectangle geometry into the block you place at design stage and use layering to either make it an "approved" or "design" block; or 2) Keep an "approved" version of each block somewhere on your server. These should be named to exactly match the ones you're using at design stage (so car, mlcp, etc.). Once you're drawing's approved, go INSERT then BROWSE, select your "approved" version of the block, when it asks you whether you want to redefine the block or not tell it YES, and all of your blocks which change to the new style. dJE Quote
Grrr Posted April 5, 2016 Posted April 5, 2016 Why not edit the block itself: make it from car to rectangle, and RENAME it. Or add multiple visibility states. Or make some rectangle block and use a "replace block" lisp. I'm just throwing options that might suit you! Quote
Hsanon Posted April 6, 2016 Author Posted April 6, 2016 The approval authority runs some program which picks up plines from different layers and distinguishes them by colour , lineweights & linetype. This gives them some answer which allows them to figure out if the submission is OK. The program does not accept blocks. Which is why i need to trace my standard car block with polylines with different colours / lineweights ..... I could make out different rectangular blocks with the correct layer / lineweight and explode them, and then use the "join" command to convert the lines to plines would join lines of other adjacent blocks if they were touching each other. i am trying to figure out a way to filter out other objects & choose the block, figure out the block insert layer (to let me know the color / lineweight of the pline reqd) and automatically make that pline rectangle in the same angle / direction of the block. thanks for your suggestions.... Quote
Hsanon Posted April 6, 2016 Author Posted April 6, 2016 I just tried exploding the block after assigning the lineweights / colours. It doesn't lose the line weight & polyline configuration on explosion !!! why was i under the impression that the block would be left with just lines & all other info would be stripped from it ???? now, can someone suggest a good "replace block" lisp ????? or a "copy block over an existing block" lisp ??? something which figures out the layer of the original block and matches & inserts the correct rectangular block in the correct orientation...... the original block need not be deleted as the new block is coming on a different layer. (there are many different types original blocks which need to be replaced and a routine which would do all together would be wonderful ) All i would need to do is then explode the blocks !!! whew !!! thanks for your help guys.... sometimes just talking on this forum gives ideas and solutions !!! Quote
Grrr Posted April 6, 2016 Posted April 6, 2016 "copy block over an existing block" lisp ??? I was thinking for asking the same thing, by providing more detailed explanation how the code should work. But I don't know is it possible to store coordinates of the "copy" points locally for each selected block. can someone suggest a good "replace block" lisp I keep this in my toolbox: (defun c:Block-Replace (/ *error* blk f ss temp) ;; Replace multiple instances of selected blocks (can be different) with selected block ;; Size and Rotation will be taken from original block and original will be deleted ;; Required subroutines: AT:GetSel ;; Alan J. Thompson, 02.09.10 (vl-load-com) (defun *error* (msg) (and f *AcadDoc* (vla-endundomark *AcadDoc*)) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))) (princ (strcat "\nError: " msg)) ) ) (if (and (AT:GetSel entsel "\nSelect replacement block: " (lambda (x / e) (if (and (eq "INSERT" (cdr (assoc 0 (setq e (entget (car x)))))) (/= 4 (logand (cdr (assoc 70 (tblsearch "BLOCK" (cdr (assoc 2 e))))) 4)) (/= 4 (logand (cdr (assoc 70 (entget (tblobjname "LAYER" (cdr (assoc 8 e)))))) 4)) ) (setq blk (vlax-ename->vla-object (car x))) ) ) ) (princ "\nSelect blocks to be repalced: ") (setq ss (ssget "_:L" '((0 . "INSERT")))) ) (progn (setq f (not (vla-startundomark (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) ) (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*)) (setq temp (vla-copy blk)) (mapcar (function (lambda (p) (vl-catch-all-apply (function vlax-put-property) (list temp p (vlax-get-property x p)) ) ) ) '(Insertionpoint Rotation XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor ) ) (vla-delete x) ) (vla-delete ss) (*error* nil) ) ) (princ) ) (defun AT:GetSel (meth msg fnc / ent good) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (setvar 'errno 0) (while (not good) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((vl-consp ent) (setq good (cond ((or (not fnc) (fnc ent)) ent) ((prompt "\nInvalid object!")) ) ) ) ((eq (type ent) 'STR) (setq good ent)) ((setq good (eq 52 (getvar 'errno))) nil) ((eq 7 (getvar 'errno)) (setq good (prompt "\nMissed, try again."))) ) ) ) Quote
Hsanon Posted April 11, 2016 Author Posted April 11, 2016 its brilliant Grrr...... Thanks a lot for the block replacement program.... 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.