Jump to content

LISP Help


zoom108

Recommended Posts

Hello,

 

So a simple question for the right person. I utilize Al's Steel Mill heavily in my detailing job and would like to edit one of the functions of the LISP routine.

 

Instead of the function reading dimensions and drawing 3D shapes, I want to change it to read the dimension information and instead just translate it to a MTEXT field that I can paste into my drawing.

 

Another way could just be to create another simple LISP and read information from another .dim file.

 

Ultimately I'm looking for a text printout of Name, Depth, and Width Information.

 

Any help is appreciated.

Link to comment
Share on other sites

I've attached the LSP and DCL files. Again though, if it would be simpler how could I just read a line from the Stl_W.dim file and convert it to MTEXT?

 

David

lisp fiels.zip

Link to comment
Share on other sites

If you just want to get a line from the DIM file in as MTEXT, you could try this: (disclaimer - works in BricsCAD)

 

Open the file (I used Notepad) and then highlight the line, copy and paste it into AutoCAD. It should come in as MTEXT. For that matter, you could select all and copy/paste into AutoCAD as MTEXT but it would be a LOT of lines.

Link to comment
Share on other sites

The idea is to use a command to quickly import information from the table regarding one steel piece.

 

NAME: W10X12

DEPTH: 9.87

DET DEPTH: 9-7/8"

 

WEB THK: 3/16"

FLANGE THK: 3/16"

 

F GUAGE: 2-1/4"

W GUAGE: 8-3/8"

 

I'm not looking for someone to create all of it, but as a non-programmer some help in the initial command line to pull say the name from that dim file would be all I need to get started.

 

I get that copy and paste would be a solution but the goal is to automate and not have to have other documents look through tables of other extra information.

 

David

Link to comment
Share on other sites

Have you contacted Al? I see he has his contact info in the LSP. Might want to check with him about modifying this code. I see that he combined some other code to get this done, but seeing a copyright notice always makes me nervous...

 

If there's no problem with Al, one thing you could try is building a separate LSP to OPEN and READ-LINE the .DIM file.

 

AfraLISP has a good walk-through on how to do this:

 

http://www.afralisp.net/autolisp/tutorials/file-handling.php

Link to comment
Share on other sites

Als steel mill has lots of DIM files so need a pick right one using "findfile" but here is a start using a filename.

 

(defun dosome ()
(Princ "do your thing") ; close file do text and then use (exit) 
)
(setq component (getstring "enter name of component"))
(setq fo (open (setq fname "C:\\acadtemp\\Stl_W.dim") "R"))
(while (setq newline (read-line fo))
(if (/= (VL-STRING-SEARCH component Newline ) NIL)
(dosome) ; do your thing here
(Princ "\nmissed") 
)
)
(close fo)(close fo)

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