Author Topic: Semi Automated Dimensioning - Kind of a Challenge  (Read 2587 times)

0 Members and 1 Guest are viewing this topic.

David Bethel

  • Swamp Rat
  • Posts: 656
Semi Automated Dimensioning - Kind of a Challenge
« on: October 29, 2010, 11:50:33 AM »
Greetings,

For anyone who has tried, they know that to ( entmake ) a dimension is a royal PIA.

How about:

To make a  block / insert  programmaticly that would represent a simple dimension

based on 4 inputs
  pt1
  pt2
  tp - text line pt
  ts - textsize
 
(dim_auto pt1 pt2 tp ts)
 
 
Vertical and horizontal style only - based on angle of pt1 pt2

Value could be text or attrib  - distance from pt1 to pt2

Arrows or tick marks or any type of end

Any color combinations of lines and text  Suite your own tastes

Use the curent settings for textstyle, layer etc

WCS, 2D only
 
The result is to automate dimensioning on 2d elevations  Similar to the serving cart shown



I have some dimensioning routines that are way overkill for simple process like this.

-David

 
R12 Dos - A2K

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #1 on: October 29, 2010, 11:54:35 AM »
What do you mean by `Challenge'? Do mean to get several people to do this for you so that you can pick the best one or do you mean that you are challenged by this problem. If the later, then there is no need to state that because its obvious by your asking the question.

Ambassadors, they're everywhere.

Anyway ... Cool challenge David.

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #2 on: October 29, 2010, 12:00:41 PM »
maybe an input:

Code: [Select]

   (initget 1)
   (setq pt1 (getpoint "\nFirst Point:   "))

   (initget 1)
   (setq pt2 (getpoint pt1 "\nSecond Point:   "))

   (initget 1)
   (setq tpt (getpoint "\nText Line Point:   "))

   (initget 6)
   (setq ts (getdist (strcat "\nTextSize <"
                     (rtos (getvar "TEXTSIZE") 2 2)
                     ">:   ")))
   (or ts (setq ts (getvar "TEXTSIZE")))

   (dim_auto pt1 pt2 tp ts)
R12 Dos - A2K

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #3 on: October 29, 2010, 12:05:44 PM »

What do you mean by `Challenge'? Do mean to get several people to do this for you so that you can pick the best one or do you mean that you are challenged by this problem. If the later, then there is no need to state that because its obvious by your asking the question.


I don't really know how to respond to that one......

Thought about it and nothing seems quite appropriate for public consumption postings.
R12 Dos - A2K

hermanm

  • Guest
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #4 on: October 29, 2010, 01:19:15 PM »
Quote
For anyone who has tried, they know that to ( entmake ) a dimension is a royal PIA

OK, but why not use Active X?

Code: [Select]
(defun C:adddimh ( / pt1 pt2 pt3)
  (setq *model_space*
    (vla-get-ModelSpace
      (vlax-get (vlax-get-acad-object) 'ActiveDocument)))
  (setq pt1 (getpoint "First Dimension Point:"))
  (setq pt2 (getpoint pt1 "Second Dimension Point:"))
  (setq pt3 (getpoint "Dimension Line Location:"))
  (vlax-invoke *model_space* 'AddDimRotated pt1 pt2 pt3 0.0)
)

(defun C:adddimv ( / pt1 pt2 pt3)
  (setq *model_space*
    (vla-get-ModelSpace
      (vlax-get (vlax-get-acad-object) 'ActiveDocument)))
  (setq pt1 (getpoint "First Dimension Point:"))
  (setq pt2 (getpoint pt1 "Second Dimension Point:"))
  (setq pt3 (getpoint "Dimension Line Location:"))
  (vlax-invoke *model_space* 'AddDimRotated pt1 pt2 pt3 (/ pi 2))
)

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #5 on: October 29, 2010, 01:40:27 PM »
The releases I use don't have activex - R14 and before.

I'll look and see if I can make heads or tails of it.  Thanks!  -David
R12 Dos - A2K

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #6 on: October 30, 2010, 02:37:57 PM »
I started off thinking that the dim direction variable wasn't going to be needed base on the points, but that didn't work out too well
Code: [Select]
;;;ENTMAKE A SIMPLE DIMENSION BLOCK WITH ATTRIBUTES
;;;ARG -> dim_dir(H/V) point1 point2 text_line_vector_point text_size
;;;RET -> ename
;;;SYNTAX -> (dim_auto "V" '(6 2 0) '(8 14 0) '(14 4 0) 2.4)

(defun dim_auto (dr pt1 pt2 tp ts /
                 sp1 sp2 te1 te2 ofa scp
                 txv tcp lcp ep1 ep2 bn sdef)

;;;PERSONALIZE SETTINGS
  (setvar "DIMZIN" 9)
  (setvar "UNITMODE" 1)
  (setvar "ELEVATION" 0)
  (setvar "THICKNESS" 0)
  (setvar "LUNITS" 2)
  (setvar "LUPREC" 2)

  (defun pte (p)
      (list (car p) (cadr p) (getvar "ELEVATION")))

  (entmake (list (cons 0 "BLOCK")(cons 10 pt1)(cons 2 "*U")(cons 70 1)))

;;;VERTICAL DIM LINES
  (and (= dr "V")
       (setq txv (abs (- (cadr pt1) (cadr pt2)))
             ofa (if (>= (car tp) (car pt1)) 0 1)
             sp1 (pte (polar pt1 (* pi ofa) ts))
             te1 (pte (list (car tp) (cadr sp1) (caddr sp1)))
             ep1 (pte (polar te1 (* pi ofa) ts))
             sp2 (pte (polar pt2 (* pi ofa) ts))
             te2 (pte (list (car tp) (cadr sp2) (caddr sp2)))
             ep2 (pte (polar te2 (* pi ofa) ts))
             tcp (pte (polar te1 (angle te1 te2) (* (distance te1 te2) 0.5)))
             scp (pte (polar tcp (* pi 1.5) (* ts 3))))
       (entmake (list (cons 0 "LINE")(cons 62 1)(cons 6 "CONTINUOUS")
                      (cons 10 sp1)(cons 11 ep1)))
       (entmake (list (cons 0 "LINE")(cons 62 1)(cons 6 "CONTINUOUS")
                      (cons 10 sp2)(cons 11 ep2)))
       (entmake (list (cons 0 "LINE")(cons 62 2)(cons 6 "CONTINUOUS")
                      (cons 10 (polar te1 (angle te2 te1) ts))
                      (cons 11 (polar tcp (angle te2 te1) ts))))
       (entmake (list (cons 0 "LINE")(cons 62 2)
                      (cons 10 (polar te2 (angle te1 te2) ts))
                      (cons 11 (polar tcp (angle te1 te2) ts)))))

;;;HORIZONTAL DIM LINES
  (and (= dr "H")
       (setq txv (abs (- (car pt1) (car pt2)))
             ofa (if (>= (cadr tp) (cadr pt1)) 0.5 1.5)
             sp1 (pte (polar pt1 (* pi ofa) ts))
             te1 (pte (list (car sp1) (cadr tp) (caddr sp1)))
             ep1 (pte (polar te1 (* pi ofa) ts))
             sp2 (pte (polar pt2 (* pi ofa) ts))
             te2 (pte (list (car sp2) (cadr tp) (caddr sp2)))
             ep2 (pte (polar te2 (* pi ofa) ts))
             lcp (pte (list (* 0.5 (+ (nth 0 te1) (nth 0 te2)))
                            (* 0.5 (+ (nth 1 te1) (nth 1 te2)))))
             tcp (pte (polar lcp (* pi 0.5) ts))
             scp (pte (polar lcp (* pi 1.5) ts)))
       (entmake (list (cons 0 "LINE")(cons 62 1)(cons 6 "CONTINUOUS")
                      (cons 10 sp1)(cons 11 ep1)))
       (entmake (list (cons 0 "LINE")(cons 62 1)(cons 6 "CONTINUOUS")
                      (cons 10 sp2)(cons 11 ep2)))
       (entmake (list (cons 0 "LINE")(cons 62 2)(cons 6 "CONTINUOUS")
                      (cons 10 (polar te1 (angle te2 te1) ts))
                      (cons 11 (polar te2 (angle te1 te2) ts)))))

;;;TICK MARKS
  (entmake (list (cons 0 "LINE")(cons 62 3)(cons 6 "CONTINUOUS")
           (cons 10 (polar te1 (* pi 0.25) ts))
           (cons 11 (polar te1 (* pi 1.25) ts))))
  (entmake (list (cons 0 "LINE")(cons 62 3)(cons 6 "CONTINUOUS")
           (cons 10 (polar te2 (* pi 0.25) ts))
           (cons 11 (polar te2 (* pi 1.25) ts))))

  (setq bn (entmake (list (cons 0 "ENDBLK"))))

;;;CURRENT TEXT VALUES
  (setq sdef (tblsearch "STYLE" (getvar "TEXTSTYLE")))

;;;MAKE AN INSET WITH ATTRIBUTES
  (entmake (list (cons 0 "INSERT")(cons 2 bn)(cons 10 pt1)(cons 66 1)))
  (entmake (list (cons 0 "ATTRIB")
                 (cons 1 (strcat (rtos txv) "\""))
                 (cons 2 "DIM-VALUE")
                 (cons 7 (cdr (assoc 2 sdef)))
                 (cons 10 tcp)(cons 11 tcp)
                 (cons 39 1e-8)(cons 40 ts)
                 (assoc 41 sdef)(cons 51 (cdr (assoc 50 sdef)))
                 (cons 62 1)(cons 70 0)(cons 72 4)))
  (entmake (list (cons 0 "ATTRIB")
                 (cons 1 "")
                 (cons 2 "STR-VALUE")
                 (cons 7 (cdr (assoc 2 sdef)))
                 (cons 10 scp)(cons 11 scp)
                 (cons 39 1e-8)(cons 40 ts)
                 (assoc 41 sdef)(cons 51 (cdr (assoc 50 sdef)))
                 (cons 62 4)(cons 70 0)(cons 72 4)))
  (entmake (list (cons 0 "SEQEND")))

  (entlast))
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #7 on: October 31, 2010, 05:45:05 PM »
David,
I'm at a loss as to why you want pseudo dimensions.
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.

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Semi Automated Dimensioning - Kind of a Challenge
« Reply #8 on: November 01, 2010, 01:58:50 PM »
CAB,

I use multiple setups and dimensions:
 
 4 main platforms 12 ,13, 14 & A2K
 decimal, archticural, metric and mixed
 3   1-1\2    1   3\4   1\2   3\8   1\4   1\8 Scales
 
 Making a programmable DIMSTYLE from scratch isn't practical, justy as entmaking a DIMENSION entity isn't
 R12 has 37 DIM* sysvars, 2000 has 69
 You probably need another dozen or so to make a complete setup
 
For this particular process,  I make the 3 elevations and the 2 isometric views from a 3D model and I have to dimension certain aspects fro the detail drawings.  Some projects have 12-15 units and each unit goes thru the same process.  I have the elevations and isometrics automated, so an automated pseudo dimension is all I need.
 
 Hope this make sense.  -David
R12 Dos - A2K