Author Topic: .cat files? How do they work in LISP??  (Read 30074 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Re: .cat files? How do they work in LISP??
« Reply #30 on: May 30, 2007, 04:40:20 PM »
Quote
Let's say you have a "host" drawing called "BOLTS".  Within that host drawing you have blocks of various size/length bolts and from your little do-hickey there, you can import a block from the host drawing into the current drawing??

Exactly.  Lets say you want to complete a suite of window details.  Everytime the damn architect wants a new sill detail, or casing detail, or whatever, just take a detail that's closest in said drawing; copy; explode; modify; save with a new name; bang: Dialog updates, preview updates, instantly available to users, your a small autocad god, etc.

Take a look at the attached.

You'll need to add somewhere:

Code: [Select]
(vl-load-com)

(setq jbthisdrawing(vla-get-activedocument(vlax-get-acad-object)))

And just make sure OpenDCL.arx is loaded.

James

You mean darn architect?

Where do I get opendcl.arx for 2008?

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: .cat files? How do they work in LISP??
« Reply #31 on: May 30, 2007, 04:43:55 PM »
Quote
You mean darn architect?
I can say that - I am one!!  :lmao: (it's funnier than you think)

OpenDCL is here:

http://sourceforge.net/projects/opendcl
James Buzbee
Windows 8

GDF

  • Water Moccasin
  • Posts: 2081
Re: .cat files? How do they work in LISP??
« Reply #32 on: May 30, 2007, 04:49:25 PM »
James

When I go to the site...all I want  (or need) is the arx file. What is the full install?

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: .cat files? How do they work in LISP??
« Reply #33 on: May 30, 2007, 05:09:37 PM »
James

When I go to the site...all I want  (or need) is the arx file. What is the full install?

Gary

James

Ok, I have the opendcl.arx file and have run your routine (loaded all files).

Command: ; error: no function definition: JB:STANDARDANNOBLOCKADD

Command: ; error: no function definition: JB:OPENDBXDOCUMENT

No image and the error messages above^

Thanks

Gary

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

AVCAD

  • Guest
Re: .cat files? How do they work in LISP??
« Reply #34 on: May 30, 2007, 05:20:45 PM »
As much as i appreciate the info on OpenDCL and yet another way I will probably have to learn to do things...I think I am gonna focus on this untill i can get it down pretty good. I  think Either way you have to know LSP dont you? the Creating the DCL was never a probaly for me its the LSP code that does it....

Ok anyways..

I up loaded a new version some code changes and what not...it asks me for a block name now when i run the insert command...but I have a (strcat path blknm) in there but its not taking it...both variables are set correctly but its jsut not going into the insert command right. I think I am doing it right but I am sure there is like a . or a ; or a ) missing somewhere....

Some blocks are included in the attachment jsut the ones that its coded for right now


T.Willey

  • Needs a day job
  • Posts: 5251
Re: .cat files? How do they work in LISP??
« Reply #35 on: May 30, 2007, 05:39:36 PM »
You are making this harder than it needs to be.  This whole defun is not needed.
Code: [Select]
(defun get_blknm()
  (cond
    ((= books "0") (= block "0") (setq blknm "PS1.dwg"))
    ((= books "0") (= block "1") (setq blknm "PS2.dwg"))
    ((= books "0") (= block "2") (setq blknm "PS3.dwg"))
    ((= books "0") (= block "3") (setq blknm "nil"))
    ((= books "0") (= block "4") (setq blknm "SP1.dwg"))
    ((= books "0") (= block "5") (setq blknm "SP2.dwg"))
    ((= books "0") (= block "6") (setq blknm "SP3.dwg"))
    ((= books "0") (= block "7") (setq blknm "SP4.dwg"))
    ((= books "0") (= block "8") (setq blknm "SP5.dwg"))
    ((= books "0") (= block "9") (setq blknm "SP6.dwg"))
    ((= books "0") (= block "10") (setq blknm "SP7.dwg"))
    ((= books "0") (= block "11") (setq blknm "SP8.dwg"))
    ((= books "0") (= block "12") (setq blknm "SP9.dwg"))
    ((= books "0") (= block "13") (setq blknm "SP10.dwg"))
    ((= books "0") (= block "14") (setq blknm "SP11.dwg"))
    )
  )
With running the code, the variable 'avlist' returns this.
Quote
"PS1: Tab Tensioned Projection Screen"
"PS2: Manual Projection Screen"
"PS3: Motorized Projection Screen"
"[....]"
"SP1: Recessed Speaker Enclose"
"SP2: Flush Mounted Speaker"
"SP3: Landscape Speaker"
"SP4: Pendant Speaker"
"SP5: Pole Mounted Speaker"
"SP6: Recessed Program Speaker"
"SP7: Ceiling Speaker"
"SP8: Ceiling Speaker"
"SP9: Recessed Subwoofer Speaker"
"SP10: Ceiling Mounted Program Speaker"
"SP11: Wall Mounted Program Speaker"
With this part of the code
Code: [Select]
(action_tile "dlist" "(setq block $value)")You get a string containing a number, which will relate to and item in the above list.  Lets say block = "1" for now.  This means that you want to insert "PS2.dwg".  This
Code: [Select]
(setq tempStr (nth (atoi block) avlist))will set tempStr = "PS2: Manual Projection Screen".  Now since you have an identifier between the block name and the description, you can trim the string to show only the block name with something like
Code: [Select]
(setq Pos (vl-string-search ":" tempStr))
(setq BlkName (substr tempStr 1 Pos))
Now BlkName = "PS2", so your insert part will look like
Code: [Select]
(command "_.insert" (strcat path BlkName ".dwg") pause pause pause)
Does this make sense?  The great thing about lisp is lists.  Learn to use them and you can do so many things.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: .cat files? How do they work in LISP??
« Reply #36 on: May 30, 2007, 06:30:53 PM »
Gary, let me correctly wrap this into an application instead of piecemealing it together.  I have multiple sub routines spread out over a wide array of files.  Let me put something together tested and I'll post . . ..
James Buzbee
Windows 8

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: .cat files? How do they work in LISP??
« Reply #37 on: May 30, 2007, 06:41:07 PM »
Forgot one little routine.  I copied them all into one file.  This works for me . . ..
James Buzbee
Windows 8

Guest

  • Guest
Re: .cat files? How do they work in LISP??
« Reply #38 on: May 31, 2007, 08:35:48 AM »
Nice little proggy... Can't wait to disect it.   :evil:

One thing I noticed... The DWG preview is mirrored.  I assume it's not like that on your end?  The drawing inserts just fine, but the view is flip-flopped.

GDF

  • Water Moccasin
  • Posts: 2081
Re: .cat files? How do they work in LISP??
« Reply #39 on: May 31, 2007, 11:35:01 AM »
Forgot one little routine.  I copied them all into one file.  This works for me . . ..

James

Thanks...still getting an error.

Command: JBDETAILMANAGER
; error: bad argument type: stringp nil

Command:
Command: ; error: bad argument type: stringp nil

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Guest

  • Guest
Re: .cat files? How do they work in LISP??
« Reply #40 on: May 31, 2007, 11:41:54 AM »
1. You have to have a KB.dws file
2. You need a subfolder called DETAILS
3. The attached DWG goes into the DETAILS folder

(I think that's all)

AVCAD

  • Guest
Re: .cat files? How do they work in LISP??
« Reply #41 on: May 31, 2007, 12:58:52 PM »
Ok...

TW..I took you advice and youre right that was alot easier to get I dont need to have a big long list of Cond statments...thanks! I didnt know how that all worked which is why i probably never thought of it.

But i still get this



The insert command should work....if I run it manually and copy and past in the strcat like it works fine but in when you hit except i get the above. it just asks for a block name its like it isnt reading the strcat in the command....idk..

I attached the latest of the code no blocks cause you should have them from the previous posting.

maybe I jsut attached the code wrong but i dont know from the looks of it too me at least it should work.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: .cat files? How do they work in LISP??
« Reply #42 on: May 31, 2007, 01:56:56 PM »
AVCAD
Another version to consider.

<edit: new lisp>
« Last Edit: May 31, 2007, 03:07:17 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVCAD

  • Guest
Re: .cat files? How do they work in LISP??
« Reply #43 on: May 31, 2007, 02:12:55 PM »
hmm...i tried it but it froze my ACAD...

i think i am pretty close on mine, I jsut dont know why it gives me what i get in my last post...after that works I jsut have to get the slides too work....might be easier then i think though

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: .cat files? How do they work in LISP??
« Reply #44 on: May 31, 2007, 03:08:49 PM »
Sorry about that, I changed the lisp file if you want to try again.

I only wanted to expose you to other ways to write the routine.

PS there is no error trap on the INSERT command, That is where I get errors.
« Last Edit: May 31, 2007, 03:11:32 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.