BOM Lengths and Line Numbering and reference.

BOM Lengths and Line Numbering and reference.

Anonymous
Not applicable
5,483 Views
4 Replies
Message 1 of 5

BOM Lengths and Line Numbering and reference.

Anonymous
Not applicable

I am trying to find a way to use a lisp like BOMLengths.lsp to get actual line lengths. What I need to do is reference the lines so I know which line is which length

 

Process is as follows.

1. Get line lengths and transfer into an excel spreadhsheet that pumps out a result based on various parametres.

2. manually add text in CAD showing the result from Excel.

 

Process I would like to see.

1. Generate a text reference with prefix for each line before a list of line lengths are generated (either on screen or in csv)

2. import / copy the line lengths into Excel to get the result.

3a. Make a table from Excel and import it into CAD so I can see the result of each line. (see attachement Line Numbering.jpg)

3b. Or eventually take it one step further and then have the text table from Excel replace the line reference. (see attchament line numbering and replacement.jpg)

 

Currently there are lisps that can do parts independently. Such as this one: http://www.lee-mac.com/numinc.html. This handles the reference.

 

There is also the very comon BOMlengths.lsp http://jtbworld.com/autocad-bomlengths-lsp that give me line lengths, but I have no idea where each of the lines are. I might have 50 or more lines I need to do this for.

 

Does anyone know of a package that can add a reference and create a list of line lengths or know of how I could go about acheiving this?

0 Likes
Accepted solutions (1)
5,484 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

I can imagine the point 1. But you need to think about the workflow.

 

I guess there must be some system in numbering... or you don't care? Automation could be by X-axis of middle point or each line? or by Y, or in the order of selection? or in the order in they where created? Or are they polylines? Or could be that polylines which directions we could follow?

 

50 is not to much to make a 1 or 2 clicks per line... and you would be in control of whole process.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi BeeKee,

 

Workflow is as straightforward as I mentioned. I have attached a small dwg showing what I want to acheive. Please note I have been playing with this drawing and not all lines are on their own layer as I would normally do.

 

Note, at the moment I am actually noting the results for each line in text format. I am happy for now for that reference to stay as a reference.

 

I don't care about how they are numbered. I just need a line to be assigned to reference and my predefined prefix that can be transferred into Excel.

When I parse that information back into CAD as text it will effectively create a table.

 

I did say 50 lines, but that 50 lines might be per layer... This is a very simple dwg that I have sent.

 

What do you think?

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Hi... try this routine for line labels and export them to *.csv file.

 

Note that it's for LINEs only, you need to explode all PLs first. If you have some line underneath an other (you do), you need to fix it manually. If some line go across more walls, and you don't want it, break it first.

 

Not sure how about import back from Excel. I guess there are build-in functions for this job.... or if not, sure you will find some proper routine on web for that. I don't know, not using it.

 

Hope this helps.

 

Spoiler
(defun c:LineLabels ( / *error* file ss en i ptb ptm pte pts dst ang txt)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if file (close file))
    (princ))

  
  (if (and (setq ss (ssget '((0 . "LINE"))))
	   (setq file (open (strcat (getvar 'DWGPREFIX) (vl-string-right-trim ".dwg" (getvar 'DWGNAME)) ".csv") "a"))
	   )
    (progn
      (repeat (setq i (sslength ss))
	(setq en (ssname ss (setq i (1- i)))
	      ptb (cdr (assoc 10 (entget en)))
	      pte (cdr (assoc 11 (entget en)))
	      dst (distance ptb pte)
	      ang (angle ptb pte)
	      ptm (polar ptb ang (* dst 0.5))
	      ang (if (and (> ang (* 0.5 pi)) (<= ang (* 1.5 pi)))
		    (+ ang pi)
		    ang)
	      pts (cons (list ptm
			      ang
			      dst)
			pts)))
      (setq pts (vl-sort
		  (vl-sort
		    pts
		    '(lambda (p q) (< (caar p) (caar q))))
		  '(lambda (p q) (> (cadar p) (cadar q))))
	    i 0)
      (foreach e pts
	(setq txt (strcat "F" (itoa (setq i (1+ i)))))
	(entmakex (list (cons  00 "TEXT")
			(cons  10 (car e))
			(cons  11 (car e))
			(cons  40 (getvar 'TEXTSIZE)) 		; change (getvar 'TEXTSIZE) to some specifics TEXTHEIGHT
			(cons  50 (cadr e))
			(cons  01 txt)
			(cons  72 1)
			(cons  73 1)
			))
	(write-line (strcat txt "," (rtos (last e) 2 6)) file))))
  (*error* "end")
)
Message 5 of 5

Anonymous
Not applicable

Hi BeeKee,

 

that works really well. Very clever way to assign the lines.

 

I see that you didn't need to declare "DWGNAME". You just used the GetVar command.

 

I will try and see if I can make some similar lisp from this.

 

Thank you. If you ever need any Excel assistance, please let me know.

 

0 Likes