Author Topic: Automatic labeling of dimensions  (Read 3368 times)

0 Members and 1 Guest are viewing this topic.

SDETERS

  • Guest
Automatic labeling of dimensions
« on: August 02, 2006, 10:55:03 AM »
What I am need of is a way to automate assigning numbers to dimensions.  A lisp file or some command that already exists.

Basically What is happening We detail a drawing then send that drawing to inspection and then inspection people assign a number to each dimension and draw that number on the print by hand.  What I am wanting is to automate this by doing this for the inpsection people in the drawing its self.  Any thoughts would be greatly appreciated. 

Thanks
Shane

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Automatic labeling of dimensions
« Reply #1 on: August 02, 2006, 11:51:58 AM »
I am offering a routine that might get you started or you can at least cannabise from though I would wait to see if some of TheSwamp gods suggest a better way. 

The routine with a dialogue box allows you to put text after the dimension  such as "TYP" or "CLEAR".  Some routine I found on the net.  IF you are not getting much help, PM me and I will post it.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Automatic labeling of dimensions
« Reply #2 on: August 02, 2006, 11:57:54 AM »
What I am wanting is to automate this by doing this for the inpsection people in the drawing its self.

Could you expand on this. 
Do the inspectors have access to cad? 
IF they have just prints, how does the "assigned number" get back back into the drawing file currently?
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Automatic labeling of dimensions
« Reply #3 on: August 02, 2006, 12:10:16 PM »
Post those bad boys

I recently lost the one that I hade that would allow you to put text on all side of the dim.  Can't find that thing anywere.  I could really use it.

Thanks
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Automatic labeling of dimensions
« Reply #4 on: August 02, 2006, 12:38:26 PM »
Here you go.  It was posted in Cadalyst in 1999 by Mike Lapinski

I have pretty much used it as is.  If you make improvements to it send me a copy.



Code: [Select]
;Tip1566A:  DIMNOTE.LSP   Dimension Notes   (c)1999, Mike Lapinski

(defun DN_SHOWNOTE (/ LNUM LNOTE)
  (set_tile "error" "")
  (setq LNUM  (get_tile "lb_notes")
        LNOTE (nth (atoi LNUM) DM_NOTES)
  ) ;_ end of setq
  (set_tile "eb_note" LNOTE)
  (princ)
) ;_ end of defun
;;======================================================
;; Function: DN_PlaceNote
;; Purpose:  If valid note is input, close dialog box
;;======================================================
(defun DN_PLACENOTE ()
  (set_tile "error" "")
  (setq DN_MODIFIER (strcase (get_tile "eb_note")))
  (if (= DN_MODIFIER " ")
    (set_tile "error" "Invalid note string")
    (done_dialog 1)
  ) ;_ end of if
) ;_ end of defun
;;======================================================
;; Function: DN_AppendNote
;; Purpose:  Append note to selected dimension entity
;;======================================================
(defun DN_APPENDDIM (VAL PLACEMENT / ENT DVAL)
  (setq ENT (car (entsel "\nSelect dimension for note: ")))
  (while (/= "DIMENSION" (cdr (assoc 0 (entget ENT))))
    (princ "\nSelected entity is not a DIMENSION.")
    (setq ENT (car (entsel "\nSelect dimension for note: ")))
  ) ;while
  (setq ENT  (entget ENT)
        DVAL (cdr (assoc 1 ENT))
  ) ;_ end of setq
  (if (= DVAL "")
    (setq DVAL "<>")
  ) ;_ end of if
  (if (= PLACEMENT 1) ;above line
    (setq VAL (strcat DVAL " " VAL))
    (progn
      (if (wcmatch DVAL "*\\X*")
        (setq VAL (strcat DVAL "\\P" VAL))
        (setq VAL (strcat DVAL "\\X" VAL))
      ) ;_ end of if
    ) ;_ end of progn
  ) ;_ end of if
  (entmod (subst (cons 1 VAL) (assoc 1 ENT) ENT))
  (princ)
) ;_ end of defun
;;======================================================
;; Main Function - Dimension NOTE
;;======================================================
(defun C:DNO (/ DCL_ID DM_NOTES DN_ABOVE)
  (setq DCL_ID (load_dialog "dimnote.dcl"))
  (if (not (new_dialog "dimnote" DCL_ID))
    (exit)
  ) ;_ end of if
  (setq DM_NOTES '("CLR." "CLEAR" "M.O." "MIN." "MAX." "REF." "R.O."
                   "TYP." "TYPICAL" "V.I.F." "VERIFY IN FIELD" "ROUGH OPENING"
   "MASONRY OPENING"
                  )
        DN_ABOVE 0
  ) ;_ end of setq
  (set_tile "eb_note" "TYP.")
  (set_tile "dn_below" "1") ; Set as default
  (start_list "lb_notes")
  (mapcar 'add_list DM_NOTES)
  (end_list)
  (set_tile "lb_notes" "7")
  (action_tile "lb_notes" "(DN_ShowNote)")
  (action_tile "dn_above" "(setq dn_above 1)")
  (action_tile "dn_below" "(setq dn_above 0)")
  (action_tile "accept" "(DN_PlaceNote)")
  (action_tile "cancel" "(done_dialog 0)")
  (if (eq (start_dialog) 1)
    (DN_APPENDDIM DN_MODIFIER DN_ABOVE)
  ) ;_ end of if
  (unload_dialog DCL_ID)
  (princ)
) ;_ end of defun

(princ "Load DIMNOTE by typing  DNO")
(princ)

Code: [Select]
//Tip1566B:  DIMNOTE.DCL   Dimension Notes   (c)1999, Mike Lapinski

dimnote : dialog {
    label = "Dimension Notes";
    initial_focus = eb_note;
            : list_box {
                label = "Notes";
                mnemonic = "o";
                key = "lb_notes";
                height = 11;
            }
           : radio_column {
                fixed_width = true;
            : radio_button {
                    label = "Locate Below Dimension";
                    mnemonic = "B";
                    key = "dn_below";
            }
            : radio_button {
                    label = "Locate Next to Dimension";
                    mnemonic = "N";
                    key = "dn_above";
            }

           }
            : edit_box {
                label = "Note:";
                key = "eb_note";
                horizontal_alignment = left;
            }
    spacer;
    ok_cancel;
    errtile;
}


I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Automatic labeling of dimensions
« Reply #5 on: August 02, 2006, 12:45:14 PM »
This wasn't the one I had.  This one is alittle nicer to be able to select standard labels.  I am going to make a few changes then I'll post it here.

Thanks
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

CADaver

  • Guest
Re: Automatic labeling of dimensions
« Reply #6 on: August 02, 2006, 01:13:00 PM »
Okay, let me get this straight.  I have a simple little function for adding prefixes (no trapping or checking, just simple)

Code: [Select]
(defun c:dx ()
(setq dmpre (strcat (strcase (getstring "\nEnter Prefix ")) ".<>"))
(command ".dim1" "newtext" dmpre)
)

Whatever "prefix" you enter is added to every selected dimension text.

If I understand you correctly, what you need is something that will add an auto-incrementing counter to every dimension.  Is that close?? Do the numbers need to be in any specific order??

sinc

  • Guest
Re: Automatic labeling of dimensions
« Reply #7 on: August 02, 2006, 04:39:29 PM »
Basically What is happening We detail a drawing then send that drawing to inspection and then inspection people assign a number to each dimension and draw that number on the print by hand.

What exactly are you doing?  I've never seen anything where it would even be remotely useful to assign identifiers to every dimension in a drawing, so I'm curious...

SDETERS

  • Guest
Re: Automatic labeling of dimensions
« Reply #8 on: August 02, 2006, 04:53:18 PM »
What we are doing is

We designers detail a 2D print.

The print gets released and PDF electronic files get sent to everybody that needs this file including inspection

The part is manufactured and then the part comes into inspection or quality to make sure the part meets the print

Inspection starts setting the part up per the datum structure on the print.

Then they start take measurements off the part.

They have a full size print and with every dimension they record the actual measured dimension on a sheet of paper. To identify which dimension they took they put a circle with a number in the circle to identify the dimension measured.  So if I can attach some arbitrary number to each dimension, inspection does not need to make these marks by hand on a full size print.

So on the inspection report there is a Dimension identifier (the hand drawn number)  the 2d print dimension with tolerance and then the actual measured dimension.

So if you have multiple features with the same dimensions  on a part you can tell these dimensions apart by the dimension identifiers.
« Last Edit: August 02, 2006, 04:57:57 PM by SDETERS »

sinc

  • Guest
Re: Automatic labeling of dimensions
« Reply #9 on: August 02, 2006, 05:13:10 PM »
I see.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Automatic labeling of dimensions
« Reply #10 on: August 02, 2006, 05:13:57 PM »
Maybe something like (real ruff).
Code: [Select]
(defun c:NumDims (/ ss Ent Obj cnt TxtOvrStr)

(setq cnt 1)
(if (setq ss (ssget '((0 . "DIMENSION"))))
 (while (setq Ent (ssname ss 0))
  (setq Obj (vlax-ename->vla-object Ent))
  (if (= (setq TxtOvrStr (vla-get-TextOverride Obj)) "")
   (vla-put-TextOverride Obj (strcat "[" (itoa cnt) "] <>"))
   (vla-put-TextOverride Obj (strcat "[" (itoa cnt) "] " TxtOvrStr))
  )
  (ssdel Ent ss)
  (setq cnt (1+ cnt))
 )
)
(princ)
)
Tim

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

Please think about donating if this post helped you.

SDETERS

  • Guest
Re: Automatic labeling of dimensions
« Reply #11 on: August 02, 2006, 05:39:27 PM »
IF they have just prints, how does the "assigned number" get back back into the drawing file currently?

The assgined number stays hand written on the print in the inspections folder that they keep.  We designers never see this number.  Functionaly it has no value of being on the print except for inspection pourposes.  Thanks for all the help and I will look into some of the thoughts tossed around and get post back tomorrow.

Once again thanks and keep the thought coming.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Automatic labeling of dimensions
« Reply #12 on: August 03, 2006, 07:05:24 AM »
I used to do the same thing at my old job, but I used Catia not Acad. It might be best if you used Mtext inserted at the dims, that way it could be put on a non plotting layer, thisit wouldn't effect your print, but if you needed them printed you could reset the layer to print and then they would show up.

Just a thought.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

SDETERS

  • Guest
Re: Automatic labeling of dimensions
« Reply #13 on: August 03, 2006, 08:23:48 AM »
Thanks for all the info

After further review we are going to make a block with an attribute in it and just label the dimensions by hand and changing the attribute.

We use two different cad packages here one is Autocad and the Other is I-Deas and we need to stay consistent between the two software.

Once again thanks for all the feedback