Jump to content

Plotting layer tags


peccy

Recommended Posts

Hi

 

I have been given a 2D line drawing with over 200 layers that I need to check. What I need to check is that the lines are on the correct layers.

Is there a way of plotting it with the lines tagged with their layers? I'd like to be able to check a hard copy of this drawing if at all possible.

 

Thanks in advance

Link to comment
Share on other sites

I'm not sure for a hard copy although you could easily walk through the layers in a DWG file using the 'laywalk' command though. I find this is a good tool for reviewing a drawing that I am unfamiliar with.

Link to comment
Share on other sites

The drawing is of a lattice tower and the difficulty with laywalk is that you can't see the rest of the drawing as you select each layer and we need to see each line in relation to the others so as know it's the correct one.

At the moment I'm creating a multileader and adding a field to the text box but it's a long, laborious job and I was hoping to automate it in someway.

Link to comment
Share on other sites

This is quick and dirty, make sure your text style is non annotative and has text height set to zero.  Just change the text height in code 2.5 to what you want.

 


(defun labeline ( / lay stpt endpt ang dist pt oldang oldangdir old angbase)
(setq oldang (getvar 'aunits))
(setvar 'aunits 3)
(setq oldangdir (getvar 'angdir))
(setvar 'angdir 0)
(setq oldangbase (getvar 'angbase))
(setvar 'angbase 0.0)
(setq ss (ssget "x" (list (cons 0 "line"))))
(repeat (setq x (sslength ss))
(setq obj (entget (ssname ss (setq x (- x 1)))))
(setq stpt (cdr (assoc 10 obj)))
(setq endpt (cdr (assoc 11 obj)))
(setq lay (cdr (assoc 8 obj)))
(setq ang (angle stpt endpt))
(setq dist (/ (distance stpt endpt)2.0))
(setq pt (polar stpt ang dist))
(command "text" pt 2.5 ang lay)
)
(setvar 'aunits oldang)
(setvar 'angdir oldangdir)
(setvar 'angbase oldangbase)
(princ)
)
(labeline)

Link to comment
Share on other sites

Thanks BigAl, but I'm having trouble with it loading (assuming it's coding for a lisp file). When I go to load it it says unable to load. I've never done anything with lisp files before so am really wandering around in the dark here

Link to comment
Share on other sites

Peccy,

BIGALs routine works.

Apologies if any of these instructions are obvious but here goes.

Make sure you have grabbed all the text.

From the very top  bit   (defun labeline ( / lay . . . .

To the bottom line         . . . . .  (labeline)

Paste it into Notepad - other plain text editors are available. ;0)

Give it a name for example "BigALs-linelabel.lsp"

Then load this file with AutoCAD "Appload" command.

Then at AutoCAD Command Line Enter: labeline

All your LINES get a bit of text on the end aligned to the angle of the line.

 

Hope it helps.

 

Link to comment
Share on other sites

Argh! I must be doing something wrong then. When I go to load the lsp file the attached is a shot of what I'm seeing telling me it's unable to load the file. Is it me or is it the software I've got?Thanks folks for your help so far :)

layer lisp.JPG

Link to comment
Share on other sites

I tried it, it hasn't worked.

I've got the .lsp file saved in the same folder as the .dwg (just in case) and that's not made a difference. It was a .dxf but now is a .dwg, no difference. What on earth am I doing wrong?!?

Link to comment
Share on other sites

It looks like the LSP file is not in a location where AutoCAD expects it to be. Go to Options|Files and look at the folders under Support File Search Path or Working Support File Search Path. Your code file should be in one of those folders, such as "support." Put a copy there and try loading the function again.

Link to comment
Share on other sites

4 hours ago, peccy said:

I tried it, it hasn't worked.

I've got the .lsp file saved in the same folder as the .dwg (just in case) and that's not made a difference. It was a .dxf but now is a .dwg, no difference. What on earth am I doing wrong?!?

That will not work in recent versions of AutoCAD.  Put it in a folder in Options → Files tab → 'Support File Search Path' that's also in 'Trusted Locations'.

Link to comment
Share on other sites

I set it up so when loaded would run straight away that's per last line (labeline)

 

If you open explorer find the lisp file that you saved via notepad you can drag and drop onto the open Autocad dwg a message will appear about trusted location just click Ok and it should then run. I just copied from here to notepad, saved and dragged to a dwg and it worked.

 

BigALs-linelabel.lsp

Link to comment
Share on other sites

I think I may have figured out why it's not working. Our workstations are locked down so we cannot do much without administrator rights. I cannot save a file to the trusted locations listed and if I try to add a location I get an error message stating "The directory specified for log files must exist and have read/write permission. The value previously saved for the log files directory will be used."

Sadly, I think it's a good old fashioned case of computer says no

Link to comment
Share on other sites

Try drag and drop , then chase IT to give permission to add files to say a network directory, they can open lisps and look for paranoid words like delete, file. Lisp is not a hard language to read.

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...