EYNLLIB Posted February 2 Posted February 2 Currently I'm using a modified version of Lee Mac's Multi-Polyline to draw a multiline which is then converted into a closed polyline and hatched I am wondering where I would begin to have each converted multiline connected by a polyline (see image) Essentially I am drawing a plan view of walls and headers, and want to make my workflow more efficient for adding in the headers automatically Any help on a starting point would be much appreciated! This is the code I'm working with so far; ;;------------------------=={ Multi-Polyline }==-----------------------;; ;; ;; ;; This program enables the user to create objects with the appearance ;; ;; of multilines, however, which are composed of standard polylines. ;; ;; ;; ;; The program will invoke the standard AutoCAD MLINE command, ;; ;; allowing the user to construct the object with the real-time ;; ;; dynamic preview afforded by the MLINE command, with the resulting ;; ;; multiline automatically exploded & joined to form standard 2D ;; ;; polylines. ;; ;;----------------------------------------------------------------------;; ;; Author: Lee Mac, Copyright � 2010 - www.lee-mac.com ;; ;;----------------------------------------------------------------------;; ;; Version 1.0 - 2010-06-19 ;; ;; ;; ;; First release. ;; ;;----------------------------------------------------------------------;; ;; Version 1.1 - 2015-09-12 ;; ;; ;; ;; Program rewritten. ;; ;;----------------------------------------------------------------------;; (defun c:mplb ( / *error* ent sel val var dict mstyle ) (defun *error* ( msg ) (mapcar 'setvar var val) (LM:endundo (LM:acdoc)) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) ;; Open the MLINESTYLE dictionary (setq dict (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)) ) "ACAD_MLINESTYLE" ) ) ;; Check if the "BEARINGWALL" style exists (if (vl-catch-all-error-p (setq mstyle (vl-catch-all-apply 'vla-item (list dict "BEARINGWALL"))) ) (progn (alert "The multiline style 'BEARINGWALL' was not found in the drawing.") (exit) ) (setvar 'cmlstyle "BEARINGWALL") ) ;; Start Undo (LM:startundo (LM:acdoc)) ;; Set variables for hatch properties (setvar 'hpname "solid") (setvar 'hpscale 1) (setvar 'clayer "S - BEARING WALLS") (command "_.mline" "_J" "top" "") (setq ent (entlast)) (vl-cmdf "_.mline") (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\") ) ;; Check if the multiline was exploded (if (not (eq ent (setq ent (entlast)))) (progn ;; Save current variable values and set new values (setq var '(cmdecho peditaccept qaflags) val (mapcar 'getvar var) sel (ssadd) ) (mapcar 'setvar var '(0 1 0)) ;; Explode the multiline (vl-cmdf "_.explode" ent) ;; Add exploded entities to selection set (while (setq ent (entnext ent)) (ssadd ent sel)) ;; Join the exploded entities (vl-cmdf "_.pedit" "_m" sel "" "_j" "" "") ;;; Create a new selection set for the joined polyline (setq sel2 (entlast)) (setvar 'HPASSOC 1) ; make hatches associative ;; Add hatch to the joined polyline (vl-cmdf "_.bhatch" "_s" sel2 "" "") (setq hatchsel (entlast)) ; get the last created entity, which should be the hatch (vl-cmdf "_.chprop" hatchsel "" "_la" "S - SHADE" "") ; change the layer of the hatch to "S - SHADE" (vl-cmdf "_.DRAWORDER" hatchsel "" "_B" "") ) ) (*error* nil) (princ) ) ;; Start Undo - Lee Mac ;; Opens an Undo Group. (defun LM:startundo ( doc ) (LM:endundo doc) (vla-startundomark doc) ) ;; End Undo - Lee Mac ;; Closes an Undo Group. (defun LM:endundo ( doc ) (while (= 8 (logand 8 (getvar 'undoctl))) (vla-endundomark doc) ) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc) ) (vl-load-com) (princ) ;;----------------------------------------------------------------------;; ;; End of File ;; ;;----------------------------------------------------------------------;; Quote
BIGAL Posted February 2 Posted February 2 (edited) Something like this. All lisp generated. Edited February 2 by BIGAL Quote
EYNLLIB Posted February 2 Author Posted February 2 We work in 2D exclusively, but yes theoretically if the walls and headers are drawn via lisp that is what i'm looking for Quote
BIGAL Posted February 2 Posted February 2 (edited) That is all 2D no solids just fools the eye to think its drawn in 3D, the walls are 4 lines, a big hint set thickness to say 2400 metric mm draw a line do vpoint 1,1,1 you will see a wall line. A "hide" shows true walls etc, can have windows as see through or solid. Use elevations in layouts so produce working dwg's. Are you metric or imperial ? Edited February 2 by BIGAL Quote
EYNLLIB Posted February 2 Author Posted February 2 1 minute ago, BIGAL said: That is all 2D no solids just fools the eye to think its drawn in 3D, the walls are 4 lines, a big hint set thickness to say 2400 metric mm draw a line do vpoint 1,1,1 you will see a wall line. A "hide" shows true walls etc, can have windows as see through or solid. Use elevations in layouts so produce working dwg's. All I'd need is the 2d plan view like my image shows in the original post. Looking for a starting point in my code to draw the header polyline automatically between walls as i add them to the drawing Quote
BIGAL Posted February 4 Posted February 4 Ok the hint draw the lines say 2 or 4 then pick left point and right point and draw your window frame breaking the original lines. You can use a dynamic block with a wipeout is another way. So no need to break wall. Quote
JerryFiedler Posted February 4 Posted February 4 EYNLLIB, Here is my suggestion for doing what you want. I do not think you can easily modify Lee's routine to add a "line" header so I wrote a simple wrapper that should work for you. I only tested it with Lee's ORIGINAL routine on his website but I would think it would work with your modified version. For my test I set the multi-line justification to zero (centered) so the header (beam) will be in the center of the wall. To use this function: 1) Enter "wall-header" on the command line. 2) At the "start line" prompt enter J if you want to change the justification. Otherwise just click the start point of the wall. 3) Continue clicking points along the wall until your come to the point where you want the header. Click the point to end the wall then press <ENTER>. 4) At the prompt to select the end of the header just click the desired end point and a header will be drawn. 5) The next prompt will be for the start of the wall so just click the end of the new header and continue to draw wall segments. I could not think of a good way to stop this loop except to press <ESC> at the header end prompt. Perhaps someone can show me a better way. ; Routine to draw a multi-line wall with single line headers. ; Written: Jerry Fiedler - Feb 2024 ; Multi-line routine Author: Lee Mac, Copyright © 2010 - www.lee-mac.com (defun c:wall-header (/ ptS ptE) (while t (c:mpl) (setq ptS (getvar 'lastpoint)) (setq ptE (getpoint ptS "\nEnd of header or ESC.")) (entmake (list (cons 0 "LINE") ;(cons 8 headlyr) (cons 10 (trans ptS 1 0)) (cons 11 (trans ptE 1 0))) ) ) (princ) ) 1 Quote
marko_ribar Posted February 5 Posted February 5 Link to Lee's routine : https://www.lee-mac.com/mpline.html Quote
EYNLLIB Posted February 7 Author Posted February 7 (edited) On 2/4/2024 at 2:43 PM, JerryFiedler said: EYNLLIB, Here is my suggestion for doing what you want. I do not think you can easily modify Lee's routine to add a "line" header so I wrote a simple wrapper that should work for you. I only tested it with Lee's ORIGINAL routine on his website but I would think it would work with your modified version. For my test I set the multi-line justification to zero (centered) so the header (beam) will be in the center of the wall. To use this function: 1) Enter "wall-header" on the command line. 2) At the "start line" prompt enter J if you want to change the justification. Otherwise just click the start point of the wall. 3) Continue clicking points along the wall until your come to the point where you want the header. Click the point to end the wall then press <ENTER>. 4) At the prompt to select the end of the header just click the desired end point and a header will be drawn. 5) The next prompt will be for the start of the wall so just click the end of the new header and continue to draw wall segments. I could not think of a good way to stop this loop except to press <ESC> at the header end prompt. Perhaps someone can show me a better way. ; Routine to draw a multi-line wall with single line headers. ; Written: Jerry Fiedler - Feb 2024 ; Multi-line routine Author: Lee Mac, Copyright © 2010 - www.lee-mac.com (defun c:wall-header (/ ptS ptE) (while t (c:mpl) (setq ptS (getvar 'lastpoint)) (setq ptE (getpoint ptS "\nEnd of header or ESC.")) (entmake (list (cons 0 "LINE") ;(cons 8 headlyr) (cons 10 (trans ptS 1 0)) (cons 11 (trans ptE 1 0))) ) ) (princ) ) This works amazingly. Just had to update my mlstyle to work with a center justification, also modified to suit my needs slightly, thank you. see below for my modification ; Routine to draw a multi-line wall with single line headers. ; Written: Jerry Fiedler - Feb 2024, Modified by EYNLLIB - FEB 2024 ; Multi-line routine Author: Lee Mac, Copyright © 2010 - www.lee-mac.com (defun c:wh (/ ptS ptE *error*) (defun *error* (msg) (if (not (member msg '("Function cancelled" "quit / exit abort" nil))) (princ (strcat "\nError: " msg)) ) (princ) ) (while t (c:mplb) (setq ptS (getvar 'lastpoint)) (setq ptE (getpoint ptS "\nEnd of header or ESC.")) (if (not ptE) (exit)) (entmake (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 2) (cons 70 0) (cons 8 "S - BEAMS") (cons 10 (trans ptS 1 0)) (cons 10 (trans ptE 1 0)) ) ) ) (princ) ) Edited February 7 by EYNLLIB 1 Quote
m.dolek.33.7 Posted March 27 Posted March 27 Hi Yazılarınızı dıkkatlıce okudum kodlarda bazı karıstırdıgım noktalar oldu bunun için sizden isteğim bu lisp içeriğinin en son ki güncel halini lsp olarak gönderebilir misiniz. şimdiden çok teşekkür ederim iyi çalışmalar Quote
fuccaro Posted March 27 Posted March 27 Google translation: I read your articles carefully, there were some points in the codes that I confused, so I request you to send the latest version of this lisp content as lsp. Thank you very much in advance, good work Quote
Nikon Posted March 27 Posted March 27 (edited) 5 hours ago, m.dolek.33.7 said: Hi Yazılarınızı dıkkatlıce okudum kodlarda bazı karıstırdıgım noktalar oldu bunun için sizden isteğim bu lisp içeriğinin en son ki güncel halini lsp olarak gönderebilir misiniz. Use together or add to lisp mplb.lsp lisp wh.lsp add to lisp MPlineV1-1.lsp lisp wall-header.lsp wall-header_mpl.lsp wh_mplb.lsp Edited March 27 by Nikon 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.