AutoCAD Architecture Forum
Welcome to Autodesk’s AutoCAD Architecture Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BATT lisp help needed

3 REPLIES 3
Reply
Message 1 of 4
MichaelRoot
421 Views, 3 Replies

BATT lisp help needed

Hello,

I have a Batt lisp file that I'm trying to edit.... so far I have it creating a layer that I want the Batt put on. I have two challenges though. Every time I open a file, it creates the layer even though I haven't invoked the Batt command. I don't want that layer created in every file I open... just when I invoke the Batt command.

The other challenge is that I haven't been able to get it to change the Plot Style from "Normal" to "Full Saturation".

The part I'm trying to edit is here:
(if (= nil (tblsearch "layer" "A-Detl-Batt"))
(command ".layer" "m" "A-Detl-Batt" "CO" "90" "A-Detl-Batt" "LW" "0.008" "A-Detl-Batt" "D" "Architectural - Detail, Fine Batt" "A-Detl-Batt" "s" "0" "")
);end if, creates layer puts you on 0

The lisp file is attached.

Thanks in advance for the help!!

Michael Root
JEO Consulting Group
3 REPLIES 3
Message 2 of 4
David_W_Koch
in reply to: MichaelRoot

The layer creation code is not part of a defined command. That code will be run when you load the InsulBattPoly[1].lsp file; if you are set up to automatically load this file every time you open a drawing, the layer will be created if it does not already exist. I am not certain what your ultimate intent is, but suspect that you want this code to be in a subroutine that is the called at the appropriate time by the main C:BATT function.

(defun battlayer ()
(if (= nil (tblsearch "layer" "A-Detl-Batt"))
(command ".layer" "m" "A-Detl-Batt" "CO" "90" "A-Detl-Batt" "LW" "0.008" "A-Detl-Batt" "D" "Architectural - Detail, Fine Batt" "A-Detl-Batt" "s" "0" "")
);end if, creates layer puts you on 0
); end defun - battlayer

Then, somewhere in your C:BATT function, prior to drawing anything, include a line with
(battlayer)
and the subroutine will be run.

"PS" "Full Saturation" ""
inserted after you make the layer and have concluded any other subcommands should work to assign the Full Saturation plot style to the layer, provided that the Full Saturation plot style is available in the drawing in which the routine is being run. (Drawing also needs to use named plot styles.)

David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 4
MichaelRoot
in reply to: MichaelRoot

Thank you for taking the time to review this!

The part I don't understand is where to put the (battlayer). I put it right after (defun C:BATT in the Main Routine: IB, but it didn't work. It said "too few arguments"

Can you help some more?? Attached is the lisp file.
Message 4 of 4
Anonymous
in reply to: MichaelRoot

On Thu, 7 Jan 2010 10:33:17 -0800, Michaelroot <> wrote:

>Thank you for taking the time to review this!
>
>The part I don't understand is where to put the (battlayer). I put it right after (defun C:BATT in the Main Routine: IB, but it didn't work. It said "too few arguments"
>
>Can you help some more?? Attached is the lisp file.

There's quite a bit wrong with your file. That's OK, we'll fix it.

First, you have these lines (I've uncommented them):
(defun c:batt)
(if (= nil (tblsearch "layer" "A-Detl-Batt"))
(command ".layer" "m" "A-Detl-Batt" "CO" "90" "A-Detl-Batt" "LW" "0.008"
"A-Detl-Batt" "D" "Architectural - Detail, Fine Batt" "A-Detl-Batt" "s" "0"
"")
);end if, creates layer puts you on 0

First off, your defun of C:BATT is wrong; all defun statements have to have an
arguments list in their form, e.g.,

(defun FunctionName (arg1 arg2 / LocalVar1 LocalVar2)
(code...)
)

However, you do not want to define a BATT command at all. There already is one
in the Main portion of the code and that is what you want to be the actual
command.

Instead, you want an additional function which will create and set the layer, as
David suggested. This is a modified version of what David wrote:

(defun BattLayer (/ lyr)
(seq lyr "A-Detl-Batt")
;; Configure layer
(command "_.layer"
"_make" lyr
"_color" "90" lyr
"_lineweight" "0.008" lyr
"_description" "Architectural - Detail, Fine Batt" lyr
""
)
)

This will always create the proper layer (if required) and set its properties to
your standard. Note that you do not need to test whether it exists or not,
because the "make" option will do this. It will also reset the layer properties,
which is what you want in case a user changed them. It also sets the current
layer to A-Detl-Batt as well, so you do not need the additional step of
explicitly setting it.

Then, down below at line #132, you have this:
(defun C:BATT
(battlayer)
(/ *error cmde ....

You have the call to (battlayer) before the arguments list for the C:BATT
function, which is wrong.

Remove the call to (battlayer), so this reads
(defun C:BATT
(/ *error* cmde osm blips plwid pltyp ltyp typetemp pathsel pathdata pathtype
polyclosed unlktemp deltemp thktemp justtemp ucschanged ptno side pldist
plpt ibtpath pathlength isCurved vertcheck vertbulge sbase ssegs slength)

and move (battlayer) to right before the (initget) line on line #163:
(battlayer)
(initget
(strcat
"Existing Line Arc Circle Pline ELlipse Spline"
:
:

Note that the original program allows you to select an existing polyline path
and erase/redraw it on that layer. Additional code would be needed to modify
this to always use the desired layer.

Matt
matt@stachoni.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost