Jump to content

2D (p)lines vertex/intersection stormwater/water/sewer count


B.N.

Recommended Posts

Hello,

 

I have some drawings containing 2D lines in multiple layers (by pipe diameter).

Now I manually check each intersection or vertex and mark the right fittings needed.

Is it possible to create a simple object (a circle or something) at each vertex/intersection in a layer named as for example "dia 315 Y" "dia 160 elbow"....

it's only for informational purpose, the looks don't matter.

 

I need to order the right pieces and that takes a hell of a lot of time....

Knipsel.jpg

 

example.dwg

Edited by B.N.
photo added
Link to comment
Share on other sites

This would be a good idea but looking at the drawing it would need updating for this to work properly. the RWA lines switch between lines and polylines some times they don't even connect like just below your example. also some of your lines are at different elevations so their isn't an intersection even tho they look like their is. (use flatten command)

 

image.png.dba43a56cf98bf3f3aae3b3d6beca4de.png

 

for this to be an automated process it would either not know where intersections are or give you to many false positives.

it would be better to make a lisp helping you in manually selecting intersections. and then asking what kind of fitting to use.

 

Edited by mhupp
Link to comment
Share on other sites

This is another problem that can be solved better. The lines do not meet properly.

image.png.6cbd9f4613cf89cc5984dbdede174df2.png

 

You can use a wipeout under the IP text so all the lines still meet but appear broken.

 

Just me I think you need to start from ground up draw lines correct layer, do chamfer the 4 options easy choice, add pline lable. Add ends ie circle etc. Plus more, I would look at improving the whole process starting from a blank drawing. Have a think about that.

 

 

image.png

Edited by BIGAL
Link to comment
Share on other sites

  • 4 weeks later...
On 12/22/2021 at 11:16 PM, BIGAL said:

This is another problem that can be solved better. The lines do not meet properly.

image.png.6cbd9f4613cf89cc5984dbdede174df2.png

 

You can use a wipeout under the IP text so all the lines still meet but appear broken.

 

Just me I think you need to start from ground up draw lines correct layer, do chamfer the 4 options easy choice, add pline lable. Add ends ie circle etc. Plus more, I would look at improving the whole process starting from a blank drawing. Have a think about that.

 

 

image.png

Thanks,

 

RN i do start with a blank, copy blocks i've made for fittings, this does import the layers.

After placing the blocks on every intersection and drawing lines in the right layer, i do a block count for all fittings.

Could a LISP be made to let me pick a block from a list?

BUIZEN.dwg

Link to comment
Share on other sites

(defun C:BlkInsert (/ pt SS ent lst blkname)
  (vl-load-com)
  (while (setq pt (getpoint "\nPick Point"))
    (if (setq SS (ssget "_X" '((0 . "INSERT") (410 . "Model"))))
      (progn
        (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
          (if (not (member (cdr (assoc 2 (setq blk (entget ent)))) lst))
            (setq lst (cons (cdr (assoc 2 blk)) lst))
          )
        )
        (setq lst (vl-sort lst '<))
        (setq blkname (AT:ListSelect "Block(s) in Drawing" "Pick A Block" 30 60 "false" lst))
        (vl-cmdf "_.Insert" (car blkname) "_non" pt 0.0254 0.0254 0)
      )
    )
    (setq pt nil)
  )
  (princ)
)
;;----------------------------------------------------------------------------;;
;; Function to Pick form list 
;; (AT:ListSelect "Title" "Lable" ## ## "ture/false" lst)
(defun AT:ListSelect (title label height width multi lst / fn fo d f)
  (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
  (write-line (strcat "list_select : dialog { label = \"" title "\"; spacer;") fo)
  (write-line (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") fo)
  (write-line (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") fo)
  (write-line (strcat "width = " (vl-princ-to-string width) ";") fo)
  (write-line (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") fo)
  (close fo)
  (new_dialog "list_select" (setq d (load_dialog fn)))
  (start_list "lst")
  (mapcar (function add_list) lst)
  (end_list)
  (setq item (set_tile "lst" "0"))
  (action_tile "lst" "(setq item $value)")
  (setq f (start_dialog))
  (unload_dialog d)
  (vl-file-delete fn)
  (if (= f 1)
    ((lambda (s / i s l)
       (while (setq i (vl-string-search " " s))
         (setq l (cons (nth (atoi (substr s 1 i)) lst) l))
         (setq s (substr s (+ 2 i)))
       )
       (reverse (cons (nth (atoi s) lst) l))
     )
      item
    )
  )
)

 

Edited by mhupp
Link to comment
Share on other sites

21 minutes ago, mhupp said:

@Lee Mac

 

Not really understanding what you want to do. This generates a list of all block names in a model space to output to a dcl file. then the ones you higlight and click ok will be in a list.

 

(defun C:BlkSelect ()
  (if (setq SS (ssget "_X" '((0 . "INSERT") (410 . "Model")))
    (progn
      (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
        (if (not (member (cdr (assoc 2 (setq blk (entget ent)))) lst))
          (setq lst (cons (cdr (assoc 2 blk)) lst))
        )
      )
      (setq lst (vl-sort lst '<))
      (setq blklst (AT:ListSelect "Block(s) in Drawing" "Pick A Block" 30 60 "true" lst))
    )
  )
  blklst
)
;;----------------------------------------------------------------------------;;
;; Function to Pick form list 
;; (AT:ListSelect "Title" "Lable" ## ## "ture/false" lst)
(defun AT:ListSelect (title label height width multi lst / fn fo d f)
  (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
  (write-line (strcat "list_select : dialog { label = \"" title "\"; spacer;") fo)
  (write-line (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") fo)
  (write-line (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") fo)
  (write-line (strcat "width = " (vl-princ-to-string width) ";") fo)
  (write-line (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") fo)
  (close fo)
  (new_dialog "list_select" (setq d (load_dialog fn)))
  (start_list "lst")
  (mapcar (function add_list) lst)
  (end_list)
  (setq item (set_tile "lst" "0"))
  (action_tile "lst" "(setq item $value)")
  (setq f (start_dialog))
  (unload_dialog d)
  (vl-file-delete fn)
  (if (= f 1)
    ((lambda (s / i s l)
       (while (setq i (vl-string-search " " s))
         (setq l (cons (nth (atoi (substr s 1 i)) lst) l))
         (setq s (substr s (+ 2 i)))
       )
       (reverse (cons (nth (atoi s) lst) l))
     )
      item
    )
  )
)

 

 I want to click at each intersection and get a list of the blocks in my file and select one of them, is that possible?

 

Link to comment
Share on other sites

updated my code to do what you want. it will ask for a point then pop up the list. then insert that block at the point.

 

to exit either don't pick another point or hit esc.

(defun C:BlkInsert (/ c pt SS ent lst blkname)
  (vl-load-com)
  (setq c 0)
  (while (setq pt (getpoint "\nPick Point"))
    (cond
      ((< c 1) ;only calculate the list first time round.
        (setq SS (ssget "_X" '((0 . "INSERT") (410 . "Model"))))
        (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
          (if (not (member (cdr (assoc 2 (setq blk (entget ent)))) lst))
            (setq lst (cons (cdr (assoc 2 blk)) lst))
          )
        )
      )
    )
    (setq c (1+ c))
    (setq lst (vl-sort lst '<))
    (setq blkname (AT:ListSelect "Block(s) in Drawing" "Pick A Block" 55 45 "false" lst))
    (vl-cmdf "_.Insert" (car blkname) "_non" pt 0.0254 0.0254 0)
    (setq pt nil)
  )
  (princ)
)
;; List Select Dialog (Temp DCL list box selection, based on provided list)
;; title - list box title
;; label - label for list box
;; height - height of box
;; width - width of box
;; multi - selection method ["true": multiple, "false": single]
;; lst - list of strings to place in list box
;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite)
(defun AT:ListSelect (title label height width multi lst / fn fo d f)
  (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
  (write-line (strcat "list_select : dialog { label = \"" title "\"; spacer;") fo)
  (write-line (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") fo)
  (write-line (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") fo)
  (write-line (strcat "width = " (vl-princ-to-string width) ";") fo)
  (write-line (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") fo)
  (close fo)
  (new_dialog "list_select" (setq d (load_dialog fn)))
  (start_list "lst")
  (mapcar (function add_list) lst)
  (end_list)
  (setq item (set_tile "lst" "0"))
  (action_tile "lst" "(setq item $value)")
  (setq f (start_dialog))
  (unload_dialog d)
  (vl-file-delete fn)
  (if (= f 1)
    ((lambda (s / i s l)
       (while (setq i (vl-string-search " " s))
         (setq l (cons (nth (atoi (substr s 1 i)) lst) l))
         (setq s (substr s (+ 2 i)))
       )
       (reverse (cons (nth (atoi s) lst) l))
     )
      item
    )
  )
)

 

lol the blkname was messing me up for the longest time. it was only one item but it was in a list format  so it wasn't working with insert command.

(car blkname) makes a string.

 

 

 

Edited by mhupp
upated code
  • Like 1
Link to comment
Share on other sites

1st up AT:listselect was written by Alan J Thompson. That acknowledgement should be in code.

 

replace the defun

(defun C:BlkInsert (/ pt SS ent lst blkname)
  (vl-load-com)
  (setq lst (list "blkname1" "blkname2" "blkname3" "blkname4"))
  (while (setq pt (getpoint "\nPick Point"))
  (setq blkname (AT:ListSelect "Block(s) in Drawing" "Pick A Block" 30 60 "false" lst))
        (vl-cmdf "_.Insert" (car blkname) "_non" pt 0.0254 0.0254 0)
      )
  (princ)
)

Also can use dcl's and images

 

 

screenshot270.png

Edited by BIGAL
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
On 1/20/2022 at 11:38 PM, BIGAL said:

1st up AT:listselect was written by Alan J Thompson. That acknowledgement should be in code.

 

replace the defun

(defun C:BlkInsert (/ pt SS ent lst blkname)
  (vl-load-com)
  (setq lst (list "blkname1" "blkname2" "blkname3" "blkname4"))
  (while (setq pt (getpoint "\nPick Point"))
  (setq blkname (AT:ListSelect "Block(s) in Drawing" "Pick A Block" 30 60 "false" lst))
        (vl-cmdf "_.Insert" (car blkname) "_non" pt 0.0254 0.0254 0)
      )
  (princ)
)

Also can use dcl's and images

 

 

screenshot270.png

The images would be interesting! 

How can this be added?

 

What DCL's would you suggest? 

The code works as a charm! thanks @mhupp

Link to comment
Share on other sites

Just a couple of comments I don't see the need to select a bock from the list you should be able to check the 2 lines/plines, as you say they are on a layer pipe dia. So say line 1 = 160 line 2 160 and angle is 90 so its a 160 Tee block that gets inserted. 

 

A 160 & 110 at 45 is  2 blocks a 45ang 160 and a 160-110 reducer.

 

So 1st step is to work out a pick pick sequence, as a start all lines is easier. with plines have to look at picked what segments.

 

Doing  the bends would mean the 2 lines/pline have a common point so it is therefore a bend.

 

Not on the top of my list to do but never know.

 

 

Edited by BIGAL
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...