lisp/app to automatically label block/dynamicblock/polyline

lisp/app to automatically label block/dynamicblock/polyline

waseemtarik
Advocate Advocate
5,049 Views
13 Replies
Message 1 of 14

lisp/app to automatically label block/dynamicblock/polyline

waseemtarik
Advocate
Advocate

hello everyone, 

 

I have been looking for an app or lisp to help my life to be easier in drafting. however, boss always asked for how many windows do we have for each project, either in total or by floors and I've been doing that manually by counting each window. this is taking lots of time specially when working on a big project. 

so, I'm looking for an app that is window selection, to select the object and it gives me a text or mtext or attribute underneath it. to be in schedule it's much better, but it's ok as long as I know how many windows by selecting and with one click, this will safe hours of working. 

 

I've found a program from lee-mac but it won't help me alot as I wont to do window selection and gives me the automatically label. I don't care whether inside a circle or not.

http://www.lee-mac.com/autolabelattributes.html

 

so if someone can help me with that, I will really appreciate it. 

 

but please note that the lisp/app will ask me every time I do window selection by entering a number, so that every floor I can start from number 1.

 

I will attach a dwg, these polyline is horizontal of a window so when I select it, it'll give me number below, also as block or dynamic block, hope that the lisp will read a layer name or any block or dynamic block name. 

 

if it's too difficult for blocks then no problem I would count it by select similar. 

 

thanks in advance 

 

 

0 Likes
Accepted solutions (1)
5,050 Views
13 Replies
Replies (13)
Message 2 of 14

ВeekeeCZ
Consultant
Consultant

Better post some more complex drawing with the desired outcome.

So you want to sort them by layers... and regardless whether it's pl, ml or block... ?

Could number as a simple text..

 

0 Likes
Message 3 of 14

waseemtarik
Advocate
Advocate

@ВeekeeCZ I've attached another file, so this is a sample, imagine having more than 1000 windows, it'll take a while to add number. T-count won't help because these text or mtext is not there when we submit the drawings.

however the number whether it's text or mtext or attribute all same for me. also if it's inside a circle or rectangle, all good for me. all I want is a window selection so when I select the bottom polyline, it gives me the number sequentially. also asks me which number to enter so when I do the floor above I can start from number 1 again.

if the lisp will select layername and blocks it'll be perfect. 

thanks in advance.  

0 Likes
Message 4 of 14

ВeekeeCZ
Consultant
Consultant
Accepted solution

accepts lwplines, mlines and blocks

placed to 'clayer at the startpnt, sorted by x.

 

 

(vl-load-com)
(defun c:inclab ( / s)
  (and (setq s (ssget '((0 . "lwpolyline,mline,insert"))))
       (or *ilx* (setq *ilx* 1))
       (setq *ilx* (1- (cond ((getint (strcat "\nini num <" (itoa *ilx*) ">: "))) (*ilx*))))
       (setq s (mapcar '(lambda (x) (assoc 10 (entget x))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))))
       (setq s (vl-sort s '(lambda (x y) (< (cadr x) (cadr y)))))
       (foreach p s (entmake (list '(0 . "TEXT") p (cons 8 (getvar 'clayer)) '(40 . 150) (cons 1 (itoa (setq *ilx* (1+ *ilx*))))))))
  (princ)
  )

 

Message 5 of 14

3wood
Advisor
Advisor

People usually put Text / Mtext to represent the window number on a certain layer. Then you can isolate that layer and use some lisp to summarize the Text / Mtext, instead of the polylines.

0 Likes
Message 6 of 14

Sea-Haven
Mentor
Mentor

I think your approaching this wrong the windows have no intelligence they are just objects, it would be way smarter to look from the beginning ask questions create intelligent objects.

 

How many windows

Total length and height

Enter window 1 Width

Repeat for next windows check total width is correct

Draw windows

 

Each window has a block with attributes window number is displayed size is attributes set to invisible.

 

Other than a list of sizes/numbers you can now do all sorts of smart things how like how many windows same size.

 

If the dwg is typical it would be easy to replicate with lisp. Looking at it  could have single 2 3 etc vertical panels, 25 vertical edges, has 50mm bot top edges, 25 mid bar. Again all parameters.

 

screenshot284.png

 

Done this for house windows but in 2D/3D.

 

Do you know anything about Lisp or programming could be done in excel also.

 

 

 

 

0 Likes
Message 7 of 14

Sea-Haven
Mentor
Mentor

I use a library routine for input so found 5 minutes. When you change a value it can be saved so just press ok to repeat.

screenshot285.png

Message 8 of 14

waseemtarik
Advocate
Advocate

@ВeekeeCZ thank you for the lisp, is works perfect.

@Sea-Haven is this a lisp or program? could you please upload it here, so I can test and try it, you are right, to have something like that then I don't need to draw each window with stretching and coping. 

thank you all. 

0 Likes
Message 9 of 14

Sea-Haven
Mentor
Mentor

The lisp does not exist, what your producing is very straight forward plines etc. 

 

Before doing something just need some rules info etc from you.

Like start with outside overall dims ? 

Enter sizes as per images

Then loop through each window size adding a block with size atrributes in it. 

 

I thought that there may only be a few styles like all equal width,  A & B windows, A & B & A thats 3 but would be 5 7 9 your sample has 5 with 2 widths what I would call A & B & A. Just makes it easier to automate the answer, the other option would be enter sizes.  

 

What other patterns are there its not much good having to continually revise code because more option are required.

 

Are the window dimensions clear space or to centre of mullion that type of question.

screenshot287.png

 

Provide a dwg with just lines maybe showing most common patterns dont worry about there thickness.

screenshot288.png

 

 

 

 

 

0 Likes
Message 10 of 14

waseemtarik
Advocate
Advocate

@Sea-Haven Hi, sorry I didn't understand until now of what I have to provide for you. 

the picture that is attached. do you have it? if this a program? 

I have attached a CAD file a sample dwg. let me know what else should I provide. 

I hope if the picture I attached you have it as a program so I can test it and know what I can do and what I can't do. 

thanks in advance. 

0 Likes
Message 11 of 14

Sea-Haven
Mentor
Mentor

The window image was from a house package it asks questions and just draws what the user enters its 2D/3D as it punches holes in walls.

 

I will try to do something for you fit it in other stuff over this week, idea behind ABA et was to reduce questions. Understand want dimmed as well 1st go will be draw outlines. 

 

Can you private mail me with a email so can send you something and swap questions.

 

screenshot290.png

0 Likes
Message 12 of 14

Sea-Haven
Mentor
Mentor

Having trouble sending a PM

 

A question when you do 5 pane windows the smaller are same size so why would the other 3 not be the balance / 3

 

eg 5 panes 4695 o/a 

mid panes 675

others 1185 1155 1005 why not all 1115 can be done automatically set smaller value, that is my approach ?

 

0 Likes
Message 13 of 14

waseemtarik
Advocate
Advocate

@Sea-Haven I have private mail you. thank you,

the reason why is not equal because I will have different width when working on high-rise buildings.

that the design from the architect. 

thanks 

0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

Ok makes sense have almost done ABABA so will do custom next.

0 Likes