Author Topic: dwg tools  (Read 7116 times)

0 Members and 1 Guest are viewing this topic.

Notsober

  • Guest
dwg tools
« on: February 14, 2008, 06:01:28 PM »
Hi all...

trying to learn something here. but allow me to explain a little bit first.

This office is really outdated. Most of us are still using ACAD 2004, some were fortunate enough to get 2007 or 2008. But aside from that, we still create dwgs and save them down to 2000. I guess because some of our clients are more outdated than we are  :-o

Here's the deal: we have to use model space - no paperspace allowed, and certainly the viewports are banned.

When we have a dwg in the 'current' folder, as opposed to the 'previous' folder (where we keep all previous versions, old rev's in) the dwg in the current folder is always the latest rev. Okay, at the start of process, we have some dwg tools we attach on the side (see attached dwg). But when we IFC the dwg, we delete those tools, purge, zoom extents, save.

But when it comes time to rev the dwg, we have to bring back those tools. I tried making it a little simpler by making the tools.dwg a command, whereas by a simple click under the 'Insert' pull-down, it inserts the .dwg as a block. I have to first specify the scale of the block, pick insertion point, rotation angle, and lastly, explode the block so I can actually use the individual blocks.

Is there a way I can speed this process up a bit? I tried doing it, but I think I might have to write a lisp to acheive my goal.


here's what I got for inserting the initial block:
Quote
ID_InsTools    [DWG Tools]^C^C-insert;dwg_tools;s;\;  ex;;

I guess I want it to "get" scale factor of border, insert it where I specify, rotation angle to be 0, and lastly to explode it.

or am i wasting more time by this?

KewlToyZ

  • Guest
Re: dwg tools
« Reply #1 on: February 15, 2008, 10:23:32 AM »
Have you tried creating tool bars for all of your tools?
You can setup a standard folder for all of your block inserts in one location on the network and add that path to your profiles to pull from. Use this as a standard mapped drive on all machines then.

I can't remember its been so long, but didn't 2004 have palettes?

You can write a custom mnu & mnl file to load these up everytime you start AutoCAD using a shared network profile in a desktop shortcut. Even use custom icons so everyone knows the difference between regular AutoCA and the new "managed" system.

Custom menus would be fairly easy, especially if you wrote *.lsp routines to call for their specific insert.
These all appear to be schematic so do you use the dimscale for sizing these or just normal 1:1 scales?

What are the names you use for each of these blocks?
I'll give you a sample.
« Last Edit: February 15, 2008, 10:27:59 AM by KewlToyZ »

deegeecees

  • Guest
Re: dwg tools
« Reply #2 on: February 15, 2008, 10:32:30 AM »
Yes, 04' has Tool Pallettes, and from the looks of things, Mr Hollands situation warrants just what you are inferring KT. I'd be happy to help you on this Mr Holland if you need it.

KewlToyZ

  • Guest
Re: dwg tools
« Reply #3 on: February 15, 2008, 10:42:26 AM »
Thanks DG, I was just contemplating how I could get 2004 since I only have 2008 now and its all cui instead and likely palettes atc files are completely out on compatability. Open the Design Center and voila, he has his palette with no more worries.
At most you may have to go into each item and set them to use dimscale if required before exporting the final version.
Trying to remember if that was the AltScale setting?

I miss how easy those were to manage and export.
Should be a very simple issue for them to share over the network or else make a zip file to install the files locally to every machine.

deegeecees

  • Guest
Re: dwg tools
« Reply #4 on: February 15, 2008, 10:48:48 AM »
I've never used Lisp/VBA with tool palletes, is that possible? I'm thinking along the lines of a reactor in VBA called when an insert is performed to get the tblock scale.

KewlToyZ

  • Guest
Re: dwg tools
« Reply #5 on: February 15, 2008, 10:52:27 AM »
To be honest I haven't had the need for block inserts.
But that would be a curious thing to try and call a setscale routine...hmmmm.
I might have jumbled my response, I was referring to toolbars for the lisp calls.
Let me take a look  :evil:

deegeecees

  • Guest
Re: dwg tools
« Reply #6 on: February 15, 2008, 10:56:58 AM »
It's pretty much a done deal if he's willing to go the toolbar route, I'll wait for OP's response.

KewlToyZ

  • Guest
Re: dwg tools
« Reply #7 on: February 15, 2008, 11:02:17 AM »
Yeah, right click on the drawing in design center and select create tool palette  :-P
We would have to do some hacking to the atc XML file to add more functionality to a palette.
I haven't tried, not sure how the system would react to a 5 wheeled car :ugly:


deegeecees

  • Guest
Re: dwg tools
« Reply #8 on: February 15, 2008, 11:18:08 AM »
Here's one of many I used to use when I needed that kind of functionality. It takes into account multiple instances of the titleblock, as well as standard scaling, and layer control. The block is hard coded, but that's no problem to change (not very elegant but gets the job done).

KewlToyZ

  • Guest
Re: dwg tools
« Reply #9 on: February 15, 2008, 11:37:58 AM »
I'm still using a legacy routine left over from a predecessor who works for Autodesk now.
Martin Schmidt.
I've had to modify it a few times for every new release going from 2004-2008 in about a year an a half's time period on over 100 machines.
You guys in the swamp helped me with osnaps returns immensely.
This has some unique XREF library structures beyond my grasp to say the least because I never understood how these were found.
It uses object detection to position items and the interface on insert.
Needless to say, it is tough to move on because it works for all of the current standard legacy tools.
Currently I am trying to get MEP smart Objects adopted as drafting tools yet to replace much of what is used by it.
But it will likely never completely replace the legacy items used in their standards.

Invoking these involves a set of variables passed by the tool button.
^C^C(smartinsert 0 19 "clayer" "mechanical/kta_mdv005")(tstatrot)
^C^C(smartinsert 0 39 "M-HVAC-EQPM" "mechanical/kta_mis001")
^C^C(smartinsert 0 37 "M-HVAC-CDFF-ANNO" "mechanical/kta_mad001")
etc...

I need to re write the layerset, it is a bit cludgy.
« Last Edit: February 15, 2008, 11:49:53 AM by KewlToyZ »

deegeecees

  • Guest
Re: dwg tools
« Reply #10 on: February 15, 2008, 11:49:37 AM »
Yeah, that is a bit 'cludgy', I've got something very similar.

 :-D

Notsober

  • Guest
Re: dwg tools
« Reply #11 on: November 25, 2008, 04:19:25 PM »
man I've been looking for this thread... I thought I dreamed it!

hey, I'm still looking for some help with this.

I'm very specific on how I want this to be executed... Deeg, still willing to help me out?

hmspe

  • Bull Frog
  • Posts: 362
Re: dwg tools
« Reply #12 on: November 25, 2008, 07:17:41 PM »
I'm very specific on how I want this to be executed.

Provide some details and we'll see how we can help.
"Science is the belief in the ignorance of experts." - Richard Feynman

Notsober

  • Guest
Re: dwg tools
« Reply #13 on: November 25, 2008, 07:35:49 PM »
I want the code to first get the scale of the dwg, wait for me to pick insertion point, rotation angle is always 0, and lastly explode the block.

this is how i'm accomplishing it now under the INSERT menu pulldown:
Quote
ID_InsTools    [DWG Tools]^C^C-insert;dwg_tools;s;\;  ex;;

but it's still not exploding the block like I want it to.

deegeecees

  • Guest
Re: dwg tools
« Reply #14 on: December 01, 2008, 11:16:01 AM »
Deeg, still willing to help me out?

I barely have time to read this as it is, sorry unsober one. I'll chime in when/if I can.

Notsober

  • Guest
Re: dwg tools
« Reply #15 on: December 01, 2008, 11:26:24 AM »
Deeg, still willing to help me out?

I barely have time to read this as it is, sorry unsober one. I'll chime in when/if I can.

no big hurry man... noticed the original post date? LoL

deegeecees

  • Guest
Re: dwg tools
« Reply #16 on: December 01, 2008, 12:12:25 PM »
I just modified my earlier posted routine, by changing the block name. It works as you spec'ed, but it also checks for multiple instances of the block, and checks for standard scaling as well. That functionality was already there so what the heck, keep it (unless it's something you'd rather not utilize).

Code: [Select]
;dwgtools.lsp
;Created for Notsober. by P.R.Donnelly
;Date: Nov. of 2008
;Description: Inserts the drawing tools
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog

(defun isatter ()
(SETQ isatt1 (SSGET "X" '((2 . "eka-22x34-Border"))))
(if isatt1
(progn
(setq qtyisatt1 (sslength isatt1))
(if (= 1 qtyisatt1)
(setq gtg 1)
(progn
(setq err_line (strcat "There are multiple instances of eka-22x34-Border please select the one to keep"))
(alert err_line)
(command "erase" isatt1 "r" pause pause)
)
)
)
)
)

(defun getinfo ();(/ tester1 fixer1 ats3)
(setq tester1 (SSGET "X" (LIST (CONS 0 "insert") (CONS 2 "eka-22x34-Border"))))
(if tester1
(progn
(SETQ fixer1 (ssname tester1 0))
(SETQ ats3 (ENTGET fixer1))
(if ats3
(progn
(setq atstd1(cdr (assoc 41 ats3)))
(setq wutscale (rtos atstd1))
(setq atstd2
(cond
((= atstd1 1.0) "0.09375")
((= atstd1 4.0) "0.375")
((= atstd1 6.0) "0.5625")
((= atstd1 8.0) "0.75")
((= atstd1 12.0) "1.125")
((= atstd1 16.0) "1.5")
((= atstd1 24.0) "2.25")
((= atstd1 32.0) "3.0")
((= atstd1 48.0) "4.5")
((= atstd1 64.0) "6.0")
((= atstd1 96.0) "9.0")
((= atstd1 128.0) "12.0")
((= atstd1 192.0) "18.0")
((= atstd1 384.0) "36.0")
((= atstd1 120.0) "11.25")
((= atstd1 240.0) "22.5")
((= atstd1 360.0) "33.75")
((= atstd1 480.0) "45.0")
((= atstd1 600.0) "56.25")
((= atstd1 720.0) "67.5")
((= atstd1 1200.0) "112.5")
((= atstd1 2400.0) "225.0")
((= atstd1 3600.0) "337.5")
((= atstd1 12000.0) "1125.0")
((= atstd1 24000.0) "2250.0")
)
)

)
)
)
(alert "\n***No Block Data Found - Insert eka-22x34-Border at a standard scale and try again***")
)
(princ)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;end getinfo



(defun c:dwgtools ()
(setq ins_pnt01 (getpoint "\nSelect Insertion Point"))
(isatter)
(getinfo)
(if (= atstd2 nil)
(progn
(if wutscale
(progn
(setq alertxt (strcat "*eka-22x34-Border* border scale is set at " wutscale " and is not consistent with drafting standards"))
(alert alertxt)
)
)
)
)

(if (/= atstd2 nil)
(progn
(command "-insert" "*dwg_tools" ins_pnt01 atstd1 "" "")
(setq atstd2 nil)
(princ)
));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;if progn for atstd2
)
(princ)

Happy Holidays!

hmspe

  • Bull Frog
  • Posts: 362
Re: dwg tools
« Reply #17 on: December 01, 2008, 01:14:46 PM »
I want the code to first get the scale of the dwg, wait for me to pick insertion point, rotation angle is always 0, and lastly explode the block.

this is how i'm accomplishing it now under the INSERT menu pulldown:
Quote
ID_InsTools    [DWG Tools]^C^C-insert;dwg_tools;s;\;  ex;;

but it's still not exploding the block like I want it to.

I do all my standard symbols from toolbars.  Here's a sample:

Code: [Select]
(defun C:insert_240v-1ph-200a ()
  (setvar "cmdecho" 0)
  (setpower)
  (setq ds (getvar "dimscale"))
  (prompt "\nSelect insertion point...  ")
  (command "_insert" "E_240v-1ph-200a" "PS" ds pause ds ds 0)
  (command "_explode" "_last")
  (PRINC)
)

(setpower) is a function that sets the active layer to "POWER".  My drawings are all model space, scaled as appropriate, so my blocks are scaled based on dimscale.       

Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

Notsober

  • Guest
Re: dwg tools
« Reply #18 on: December 01, 2008, 02:05:52 PM »
I just modified my earlier posted routine, by changing the block name. It works as you spec'ed, but it also checks for multiple instances of the block, and checks for standard scaling as well. That functionality was already there so what the heck, keep it (unless it's something you'd rather not utilize).

Code: [Select]
;dwgtools.lsp
;Created for Notsober. by P.R.Donnelly
;Date: Nov. of 2008
;Description: Inserts the drawing tools
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog

(defun isatter ()
(SETQ isatt1 (SSGET "X" '((2 . "eka-22x34-Border"))))
(if isatt1
(progn
(setq qtyisatt1 (sslength isatt1))
(if (= 1 qtyisatt1)
(setq gtg 1)
(progn
(setq err_line (strcat "There are multiple instances of eka-22x34-Border please select the one to keep"))
(alert err_line)
(command "erase" isatt1 "r" pause pause)
)
)
)
)
)

(defun getinfo ();(/ tester1 fixer1 ats3)
(setq tester1 (SSGET "X" (LIST (CONS 0 "insert") (CONS 2 "eka-22x34-Border"))))
(if tester1
(progn
(SETQ fixer1 (ssname tester1 0))
(SETQ ats3 (ENTGET fixer1))
(if ats3
(progn
(setq atstd1(cdr (assoc 41 ats3)))
(setq wutscale (rtos atstd1))
(setq atstd2
(cond
((= atstd1 1.0) "0.09375")
((= atstd1 4.0) "0.375")
((= atstd1 6.0) "0.5625")
((= atstd1 8.0) "0.75")
((= atstd1 12.0) "1.125")
((= atstd1 16.0) "1.5")
((= atstd1 24.0) "2.25")
((= atstd1 32.0) "3.0")
((= atstd1 48.0) "4.5")
((= atstd1 64.0) "6.0")
((= atstd1 96.0) "9.0")
((= atstd1 128.0) "12.0")
((= atstd1 192.0) "18.0")
((= atstd1 384.0) "36.0")
((= atstd1 120.0) "11.25")
((= atstd1 240.0) "22.5")
((= atstd1 360.0) "33.75")
((= atstd1 480.0) "45.0")
((= atstd1 600.0) "56.25")
((= atstd1 720.0) "67.5")
((= atstd1 1200.0) "112.5")
((= atstd1 2400.0) "225.0")
((= atstd1 3600.0) "337.5")
((= atstd1 12000.0) "1125.0")
((= atstd1 24000.0) "2250.0")
)
)

)
)
)
(alert "\n***No Block Data Found - Insert eka-22x34-Border at a standard scale and try again***")
)
(princ)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;end getinfo



(defun c:dwgtools ()
(setq ins_pnt01 (getpoint "\nSelect Insertion Point"))
(isatter)
(getinfo)
(if (= atstd2 nil)
(progn
(if wutscale
(progn
(setq alertxt (strcat "*eka-22x34-Border* border scale is set at " wutscale " and is not consistent with drafting standards"))
(alert alertxt)
)
)
)
)

(if (/= atstd2 nil)
(progn
(command "-insert" "*dwg_tools" ins_pnt01 atstd1 "" "")
(setq atstd2 nil)
(princ)
));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;if progn for atstd2
)
(princ)

Happy Holidays!

cool dude. everything looks good (haven't tested it yet) but just glancing thru it I noticed "eka-22x34-Border"

that was just a sample border that I used for an example of where I place the "tools" (maybe i should start calling it "section marks and other miscellaneous blocks that I use all the time"?)

I use these "tools" on just about on every dwg that gets opened on my machine.... do I just delete that, or do ya have to tweak it a little more to make it work on just the active drawing?
« Last Edit: December 01, 2008, 02:10:40 PM by Notsober »

deegeecees

  • Guest
Re: dwg tools
« Reply #19 on: December 01, 2008, 03:04:14 PM »
Yes, it would have to be tweaked since it bases the scaling off of the eka-22x34-Border block. I'd need a list of all possible titleblocks to look for to make this functional, plus it would make more sense to put the getpoint statement right before the insert line (I was rushing it).

deegeecees

  • Guest
Re: dwg tools
« Reply #20 on: December 01, 2008, 03:44:02 PM »
I was thinking that to simplify this, one could select the block to scale off of, so it could work on any drawing regardless of the titleblocks name.

Notsober

  • Guest
Re: dwg tools
« Reply #21 on: December 02, 2008, 10:22:48 AM »
I was thinking that to simplify this, one could select the block to scale off of, so it could work on any drawing regardless of the titleblocks name.

yes. exactly.



we draw everything in modelspace, so if the scale factor was not physically visible just yet, I type in LI for LIST to get the block's scale factor.

We always use a 34x22 sized border at 1:1 (SF=1), and scale it up from there. So, basically the limits would be set to 2'-10" x 1'-10" at 1:1. At 1"=1'-0" (SF=12) the limits are 34'-0" x 22'-0".

The routine wouldn't necessarily need to automatically pick the insertion point, just get scale, I'll pick the insertion point, insert at proper scale, then explode.

deegeecees

  • Guest
Re: dwg tools
« Reply #22 on: December 02, 2008, 11:16:09 AM »
Quick and dirty, will fail if no block is selected:

Code: [Select]
;dwgtools.lsp
;Created for Notsober. by P.R.Donnelly
;Date: Nov. of 2008
;Description: Inserts the drawing tools
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog

(defun c:dwgtools ()
(setq en1 (entsel"\nSelect BLOCK for scaling: "))
(setq en2 (entget (car en1)))
(setq scl1 (cdr (assoc 42 en2)))
(setq ins_pnt01 (getpoint "\nSelect Insertion Point"))
(command "-insert" "*dwg_tools" ins_pnt01 scl1 "" "")
(princ)
)

Notsober

  • Guest
Re: dwg tools
« Reply #23 on: December 04, 2008, 02:38:20 PM »
awesome job man... but there are instances sometimes where the title block isn't a "block" at all...

how do you put an option in there to maybe choose my own scale if there isn't a block to get scale from?


maybe something like: Select BLOCK for scaling, or enter scale factor <12>:

(the <12> being an example of the last SF used if I pressed enter, or something like that...) just trying to make it somewhat error proof.

deegeecees

  • Guest
Re: dwg tools
« Reply #24 on: December 04, 2008, 02:39:33 PM »
That's doable, just need a break in the action here. I'll post a solution soon...

Notsober

  • Guest
Re: dwg tools
« Reply #25 on: December 04, 2008, 02:41:08 PM »
coolness...

Notsober

  • Guest
Re: dwg tools
« Reply #26 on: December 04, 2008, 05:38:03 PM »
uh oh, i just noticed this...
Quote
Command: dwgtools

Select BLOCK for scaling:
Select Insertion Point-insert Enter block name or [?]: *dwg_tools Specify
insertion point for block: Specify scale factor for XYZ axes: 16.00000000000000
Specify rotation angle <0.00>: Duplicate definition of block REVTRI  ignored.
Duplicate definition of block Detail_Header  ignored.
Duplicate definition of block Section_Header  ignored.
Duplicate definition of block Construction_Stamp  ignored.

Command: DWGTOOLS Unknown command "DWGTOOLS".  Press F1 for help.

deegeecees

  • Guest
Re: dwg tools
« Reply #27 on: December 05, 2008, 12:18:04 PM »
Try a purge before using that.

Notsober

  • Guest
Re: dwg tools
« Reply #28 on: December 05, 2008, 12:36:07 PM »
i already thought of that... it still does it. No matter what drawing I'm in...


but in A2004, this is what happens -
Quote
Command: purge

Command: dwgtools

Select BLOCK for scaling:
Select Insertion Point-insert Enter block name or [?]: *dwg_tools Specify
insertion point for block: Specify scale factor for XYZ axes: 16.00000000000000
Specify rotation angle <0.00>: Duplicate definition of block REVTRI  ignored.
Duplicate definition of block Detail_Header  ignored.
Duplicate definition of block Section_Header  ignored.
Duplicate definition of block Construction_Stamp  ignored.
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)

Command: DWGTOOLS Unknown command "DWGTOOLS".  Press F1 for help.

Notsober

  • Guest
Re: dwg tools
« Reply #29 on: December 05, 2008, 12:38:52 PM »
i have to add... it actually places my dwg tools in A2007, but not in 2004

deegeecees

  • Guest
Re: dwg tools
« Reply #30 on: December 05, 2008, 12:43:39 PM »
Wow, that's a whole nuther can a worms there, and I'm just getting back into coding, so you may need someone with more experience to help with that.

Notsober

  • Guest
Re: dwg tools
« Reply #31 on: December 05, 2008, 01:12:32 PM »
but man you were doing so great! LoL.

I wish I would have stayed in college  :cry: