PDA

View Full Version : A need for routine


Yancka
2007-10-09, 12:45 PM
I'm new to AutoLISP and haven't much free time to learn it (may be I should find it for this). But I know for sure 2 functions I would like to use and my feeling is that it can be done with LISP. May be somebody already has it and I don't have to write it on my own. Here's what I want:
1. routine that writes block with selected objects to the same folder where current drawing is. Conditions are: Source - Objects, Base Point - 0,0,0, Selected Objects - Retain, Destination - same folder as current drawing is in, name "new block" (or, it could be one specific place for all files, like c:\AutoCAD\temp.dwg"), Insert Units - Meters, at AutoCAD alert dialog box that such file already exists and do I want to replace it, choose YES, at next dialog box "Include AutoCAD Map information in the export" choose NO.
2. routine that inserts in step 1 created file to current drawing. Conditions are: Name -> browse\"new block.dwg" from folder where current drawing is in (or from c:\AutoCAD\temp.dwg), Insertion Point - 0,0,0, Scale - 1, Rotation - 0, Block unit - as is, Explode - checked

May be there are other ways how copying objects from one drawing to another can be done (except copy/paste because 0,0,0 as base point is important)?

I'm having Civil3D 2008 on my machine.

d_m_hopper
2007-10-09, 02:11 PM
1. routine that writes block with selected objects to the same folder where current drawing is.

Conditions are: Source - Objects, Base Point - 0,0,0, Selected Objects - Retain, Destination - same folder as current drawing is in, name "new block" (or, it could be one specific place for all files, like c:\AutoCAD\temp.dwg"), Insert Units - Meters, at AutoCAD alert dialog box that such file already exists and do I want to replace it, choose YES, at next dialog box "Include AutoCAD Map information in the export" choose NO.

2. routine that inserts in step 1 created file to current drawing. Conditions are: Name -> browse\"new block.dwg" from folder where current drawing is in (or from c:\AutoCAD\temp.dwg), Insertion Point - 0,0,0, Scale - 1, Rotation - 0, Block unit - as is, Explode - checked

this is the last portion of a routine I use at work, maybe someone can alter the code and work out what you need done.

(alert "\nOverkill & Purge will be run: ")
(load "overkillsup")
(princ
"\nSelect Objects: "
)
(setq ss(ssget))
(acet-overkill2 (list ss 0.0001 nil T nil nil))

(command "_.purge" "all" "*" "no")
(setvar "expert" 2)

(alert "\Next Steps Will Create a WBlock named 1.dwg: ")

(command "_.wblock" "c:\\home\\work\\1.dwg" "*")
(princ)
(alert "\nWBlock 1.dwg Has Been Placed In Your C:\home\work Directory: ")
)

runs overkill

runs purge all

creates wblock

saves it to a folder