Author Topic: Dimensioning round the bend!  (Read 4765 times)

0 Members and 1 Guest are viewing this topic.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Dimensioning round the bend!
« Reply #15 on: March 08, 2006, 11:19:47 AM »
Thanks Luis, I'll look at that when I get back to work in the morning

T :-)
Thanks for explaining the word "many" to me, it means a lot.

t-bear

  • Guest
Re: Dimensioning round the bend!
« Reply #16 on: March 08, 2006, 12:25:20 PM »
Tracey...try this from Keith.  I've been using it a while and it's great.
Code: [Select]
(defun C:Dimarc( / gotobj sset1 sset2 beginpoint endpoint centerpoint wpnts1 wpnts2 beginangle endangle)
 (setq oce (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (setq dcl_id(load_dialog "Dimarc"))
 ;(setcfg "AppData/BCI/Dimarczin" "8") ;zero suppression
 (if (or (= "" (getcfg "AppData/BCI/Dimarclfac"))
         (= nil (getcfg "AppData/BCI/Dimarclfac"))
     )
   (setcfg "AppData/BCI/Dimarclfac" (rtos (getvar "dimlfac") 2 8)) ;linear scale factor
 )
 (setq Dimarclfac (getcfg "Appdata/BCI/Dimarclfac"))
 (if (or (= "" (getcfg "AppData/BCI/Dimarclunit"))
    (= nil (getcfg "AppData/BCI/Dimarclunit"))
     )
  (setcfg "AppData/BCI/Dimarclunit" (rtos (getvar "lunits") 2 0)) ;units
 )
 (setq Dimarclunit (getcfg "Appdata/BCI/Dimarclunit"))
 (if (or (= "" (getcfg "AppData/BCI/Dimarcdec"))
    (= nil (getcfg "AppData/BCI/Dimarcdec"))
     )
   (setcfg "AppData/BCI/Dimarcdec" (rtos (getvar "luprec") 2 0)) ;precision
 )
 (setq Dimarcdec (getcfg "Appdata/BCI/Dimarcdec"))
 (if (or (= "" (getcfg "AppData/BCI/Dimarcpost"))
    (= nil (getcfg "AppData/BCI/Dimarcpost"))
     )
  (progn
   (setcfg "AppData/BCI/Dimarcpost" "<>") ;prefix<>suffix
   (setq prefix ""
    suffix ""
   )
  )
  (parse_dimarcpost (getcfg "AppData/BCI/Dimarcpost"))
 );if
 (while (not gotobj)
   (initget "Settings Chord")
   (setq b (entsel "\nSelect arc or [Settings/Chord]: "))
   (cond
     ((= b "Settings")
       (progn
         (new_dialog "specs" dcl_id)
         (set_all_tiles)
         (action_tile "Dimarclunit" "(read_all_tiles)")
         (action_tile "Dimarcdec"   "(read_all_tiles)")
         (action_tile "Dimarclfac"  "(read_all_tiles)")
         (action_tile "Dimarcpre"   "(read_all_tiles)")
         (action_tile "Dimarcsuf"   "(read_all_tiles)")
         (if (= 1 (start_dialog))
          (save_dimarc_cfg)
         )
       )
     )
     ((= b "Chord")
       (progn
    (while (not (and sset1 sset2))
      (setq BeginPoint (getpoint "\nSelect start point: "))
      (setq EndPoint (getpoint "\nEnd point: "))
      (setq WPnts1 (list (polar BeginPoint 0 0.2)(polar BeginPoint 1.5708 0.2)(polar BeginPoint pi 0.2)))
      (setq WPnts2 (list (polar EndPoint 0 0.2)(polar EndPoint 1.5708 0.2)(polar EndPoint pi 0.2)))
           (setq sset1 (ssget "CP" WPnts1 '((0 . "arc"))))
           (setq sset2 (ssget "CP" WPnts2 '((0 . "arc"))))
      (if (and sset1 sset2)
        (progn
          (if (not(equal (ssname sset1 0)(ssname sset2 0)))
       (progn
         (princ "\nSelected points are not on the same arc!")
         (setq sset1 nil sset2 nil)
       )
                (progn
              (setq a (entget (ssname sset1 0)))
                   (setq CenterPoint (cdr (assoc 10 a)))
         (if (and (< (cdr (assoc 51 a))(cdr (assoc 50 a)))
             (< pi (-(angle CenterPoint EndPoint)(angle CenterPoint BeginPoint)))
             )
           (setq EndAngle (min (angle CenterPoint EndPoint)(angle CenterPoint BeginPoint))
            BeginAngle (max (angle CenterPoint EndPoint)(angle CenterPoint BeginPoint))
                )
           (setq EndAngle (max (angle CenterPoint EndPoint)(angle CenterPoint BeginPoint))
            BeginAngle (min (angle CenterPoint EndPoint)(angle CenterPoint BeginPoint))
                )
         )
                   (setq gotobj T)
            )
               )
        )
             (princ "\nObject not selected!")
      )
    )
       )
     )
     (b
       (progn
         (setq a (entget (car b)))
         (if (/= (cdr (assoc 0 a)) "ARC")
           (princ "\nSelected entity is not an arc!")
      (progn
             (setq CenterPoint (cdr (assoc 10 a))
         BeginPoint (polar (cdr (assoc 10 a))(cdr (assoc 50 a))(cdr (assoc 40 a)))
         EndPoint (polar (cdr (assoc 10 a))(cdr (assoc 51 a))(cdr (assoc 40 a)))
           EndAngle (cdr (assoc 51 a))
         BeginAngle (cdr (assoc 50 a))
        )
          (setq gotobj T)
      )
         )
       )
     )
   )
 )
 (setq Aang (- EndAngle BeginAngle))
 (if (< Aang 0)
  (setq Aang (+ (* pi 2) Aang))
 )
 (setq ALen (* Aang (cdr (assoc 40 a))))
 (setq ALen (* ALen (distof (getcfg "AppData/BCI/Dimarclfac")2 )))
 (setq ALen (strcat prefix (rtos ALen (atoi (getcfg "AppData/BCI/Dimarclunit"))(atoi (getcfg "AppData/BCI/Dimarcdec"))) suffix))
 (princ "\nSpecify dimension arc line location: ")
 (setq osmode (getvar "osmode"))
 (setvar "osmode" 0)
 (command "_dimangular" "" CenterPoint BeginPoint EndPoint "T" ALen pause)
 (setvar "osmode" osmode)
 (princ (strcat "\nDimension text = " ALen))
 (setvar "cmdecho" oce)
 (princ)
)

(defun set_all_tiles()
  (setq Dimarclunit (getcfg "AppData/BCI/Dimarclunit"))
  (cond
    ((= Dimarclunit "1")(set_tile "Dimarclunit" "0"))
    ((= Dimarclunit "2")(set_tile "Dimarclunit" "1"))
    ((= Dimarclunit "3")(set_tile "Dimarclunit" "2"))
    ((= Dimarclunit "4")(set_tile "Dimarclunit" "3"))
    ((= Dimarclunit "5")(set_tile "Dimarclunit" "4"))
  )
  (set_tile "Dimarcdec" (getcfg "AppData/BCI/Dimarcdec"))
  (set_tile "Dimarclfac" (getcfg "AppData/BCI/Dimarclfac"))
  (set_tile "Dimarcpre" prefix)
  (set_tile "Dimarcsuf" suffix)
)

(defun read_all_tiles()
  (setq Dimarclunit (get_tile "Dimarclunit"))
  (setq Dimarcdec   (get_tile "Dimarcdec"))
  (setq Dimarclfac  (get_tile "Dimarclfac"))
  (setq Dimarcpre   (get_tile "Dimarcpre"))
  (setq Dimarcsuf   (get_tile "Dimarcsuf"))
  (setq prefix Dimarcpre suffix Dimarcsuf)
  (cond
    ((= Dimarclunit "0")(setq Dimarclunit "1"))
    ((= Dimarclunit "1")(setq Dimarclunit "2"))
    ((= Dimarclunit "2")(setq Dimarclunit "3"))
    ((= Dimarclunit "3")(setq Dimarclunit "4"))
    ((= Dimarclunit "4")(setq Dimarclunit "5"))
  )
  (set_tile "Dimarclfac" (setq Dimarclfac (rtos (convert_unit Dimarclfac) 2)))
)

(defun save_dimarc_cfg()
  (setcfg "AppData/BCI/Dimarclunit" dimarclunit)
  (setcfg "AppData/BCI/Dimarcdec" dimarcdec)
  (setcfg "AppData/BCI/Dimarclfac" dimarclfac)
  (setcfg "AppData/BCI/Dimarcpost" (strcat prefix "<>" suffix))
)

(defun convert_unit ( value )
  (setq tval (distof value 1))
  (if (= tval nil)
    (setq tval (distof value 2))
  )
  (if (= tval nil)
    (setq tval (distof value 3))
  )
  (if (= tval nil)
    (setq tval (distof value 4))
  )
  (if (= tval nil)
    (setq tval (distof value 5))
  )
  (if (= tval nil)
    (setq tval 1)
  )
  tval
)

(defun C:DIMARCLUNIT ()
 (if (not DIMARCLUNIT)
   (setq DIMARCLUNIT (rtos (getvar "Dimlunit") 2 0))
 )
 (setq ODIMARCLUNIT DIMARCLUNIT)
 (setq p (strcat "\nNew value for DIMARCLUNIT <"DIMARCLUNIT">:"))
 (setq DIMARCLUNIT(getstring p))
 (if (= DIMARCLUNIT "")(setq DIMARCLUNIT ODIMARCLUNIT))
 (setq tv (distof DIMARCLUNIT))
 (cond
   ((= nil tv)(dimarcluniterr))
   ((> 1 tv)(dimarcluniterr))
   ((< 5 tv)(dimarcluniterr))
   (T (setcfg "AppData/BCI/Dimarclunit" dimarclunit))
 )
 (princ)
)

(defun dimarcluniterr()
  (princ "\nRequires an integer between 1 and 5.")
  (setq DIMARCLUNIT ODIMARCLUNIT)
  (C:DIMARCLUNIT)
)

(defun C:DIMARCDEC ()
 (if (not DIMARCDEC)
   (setq DIMARCDEC (rtos (getvar "Dimdec") 2 0))
 )
 (setq ODIMARCDEC DIMARCDEC)
 (setq p (strcat "\nNew value for DIMARCDEC <"DIMARCDEC">:"))
 (setq DIMARCDEC(getstring p))
 (if (= DIMARCDEC "")(setq DIMARCDEC ODIMARCDEC))
 (setq tv (distof DIMARCDEC))
 (cond
   ((= nil tv)(DIMARCDECERR))
   ((> 0 tv)(DIMARCDECERR))
   ((< 8 tv)(DIMARCDECERR))
   (T (setcfg "AppData/BCI/DIMARCDEC" DIMARCDEC))
 )
 (princ)
)

(defun DIMARCDECERR()
  (princ "\nRequires an integer between 0 and 8.")
  (setq DIMARCDEC ODIMARCDEC)
  (C:DIMARCDEC)
)

(defun C:DIMARCLFAC ()
 (if (not DIMARCLFAC)
   (setq DIMARCLFAC (rtos (getvar "Dimlfac") 2))
 )
 (setq ODIMARCLFAC DIMARCLFAC)
 (setq p (strcat "\nNew value for DIMARCLFAC <"DIMARCLFAC">:"))
 (setq DIMARCLFAC (getstring p))
 (if (= DIMARCLFAC "")(setq DIMARCLFAC ODIMARCLFAC))
 (setq DIMARCLFAC (rtos (convert_unit DIMARCLFAC) 2))
 (setq tv (distof DIMARCLFAC))
 (cond
   ((= nil tv)(DIMARCLFACERR))
   ((> (distof "9.9999E-099" 1) tv)(DIMARCLFACERR))
   ((< (distof "9.9999E+099" 1) tv)(DIMARCLFACERR))
   (T (setcfg "AppData/BCI/DIMARCLFAC" DIMARCLFAC))
 )
 (princ)
)

(defun DIMARCLFACERR()
  (setq DIMARCLFAC ODIMARCLFAC)
  (C:DIMARCLFAC)
)

(defun C:DIMARCPOST ()
 (cond
   ((and (= "" prefix) suffix)(setq DIMARCPOST suffix))
   ((and prefix suffix)(setq DIMARCPOST (strcat prefix "<>" suffix)))
   (T (setq DIMARCPOST ""))
 )
 (setq ODIMARCPOST DIMARCPOST)
 (setq p (strcat "\nNew value for DIMARCPOST, or . for none <\""DIMARCPOST"\">:"))
 (setq DIMARCPOST(getstring p))
 (if (= DIMARCPOST "")(setq DIMARCPOST ODIMARCPOST))
 (if (= DIMARCPOST ".")(setq DIMARCPOST ""))
 (setq tv (distof DIMARCPOST))
 (setcfg "AppData/BCI/DIMARCPOST" DIMARCPOST)
 (parse_dimarcpost DIMARCPOST)
 (princ)
)

(defun parse_dimarcpost( pfxsfx )
   (if (<= (strlen pfxsfx) 2)
    (setq prefix "" suffix "")
    (progn
     (setq pointer 1
           prefix nil
      suffix nil
     )
     (while (not prefix)
      (setq testval (substr pfxsfx pointer 2))
      (if (= "<>" testval)
       (setq prefix (substr pfxsfx 1 (- pointer 1))
             suffix (substr pfxsfx (+ pointer 2)(strlen pfxsfx))
       );setq
      );if
      (setq pointer (1+ pointer))
      (if (> pointer (- (strlen pfxsfx)1))
   (setq suffix pfxsfx
         prefix ""
   )
      );if
     );while
    );progn
   );if
)
(princ "\nDimarc - Version 2.0  Copyright 2002 by BCI Computer Solutions\n")
(princ)

This will not give you the arc and straight length combined but is a good arc-dim rotine.   Best I got, kiddo!

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Dimensioning round the bend!
« Reply #17 on: March 08, 2006, 12:31:45 PM »
Thanks Mr Bear, I'll try that one too!

Many thanks
T :-)
Thanks for explaining the word "many" to me, it means a lot.

Dinosaur

  • Guest
Re: Dimensioning round the bend!
« Reply #18 on: March 08, 2006, 01:23:15 PM »
Even if you can find a work-around to display exactly what the engineer wants to see, there will still be one major problem . . . I don't see how the contractor will be able to build accurately from the plans unless all of the necessary dimensions are added as well or you send a point sheet with everything given coordinates when the thing is staked for construction.  The only thing he is deriving from this dimension scheme is a partial quantity take-off that could be calculated easily and with less chance of error when the drawing is finished . . . HARRUMPH !

Dent Cermak

  • Guest
Re: Dimensioning round the bend!
« Reply #19 on: March 08, 2006, 01:28:22 PM »
Generally, when doing "kerbing" (aka: "curbing" this side of the pond) the engineers here show the linear footage (or meters) to the PC (Point of curvature) then they show the radius of the curb curve to the PT (Point of Tangency). You can use the "curve solver" to get the rest  of the curve data (ie, curve length, etc.) Fairly straight forward if you have the Civil package.
If you bust up the polyline into its elements then the curve labeling routine in AutoCad will give you all the data you want. Then just add up the "straights" and "bends' and you have your total.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Dimensioning round the bend!
« Reply #20 on: March 08, 2006, 04:31:04 PM »
What I want to do is show the lengths of certain parts of kerbs, it is not for construction information. This is the first phase, where the engineers are trying to get the clients approval, by producing a "pretty" drawing that shows the work intent and an idea of what will be done.

Unfortunately we use MX as the design package and only to produce the design. Once finished it comes to me to "prettyfy" in AutoCAD. Somewhere in one of our branch offices there must be a civils package cos I had a proxy object from one on a job I'm working on -  so I suppose theres hope that it may come to my office eventually.
Thanks for explaining the word "many" to me, it means a lot.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Dimensioning round the bend!
« Reply #21 on: March 09, 2006, 07:23:25 AM »
To satisfy your 'designer engineer' I've written a dimensioning function on the fly. The settings come from the current
dimstyle.
Note:
- It's not bulletproof
- Text positioning/options are not by dimstyle (it's an attribute, can be positioned/rotated by grips)
- The arrow shapes are not by dimstyle (filled arrow)
- No associativity
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Dimensioning round the bend!
« Reply #22 on: March 09, 2006, 07:32:00 AM »
Thank you very much Mr Menzi, that will help immensely

Tracey :-)
Thanks for explaining the word "many" to me, it means a lot.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Dimensioning round the bend!
« Reply #23 on: March 11, 2006, 08:26:06 AM »
Hi Tracey

I've upload a new version from DimPoly...
- Support DIMBLK1/2, DIMSE1/2 and DIMDLE added
- Bug text rotation fixed
- And some more...
you may check it out.
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18