TheSwamp

CAD Forums => CAD General => Topic started by: jonesy on March 08, 2006, 05:47:00 AM

Title: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 05:47:00 AM
Forgive my ignorance but, how do I dimension and get a true length of line around a bend.

Like so...
(http://www.theswamp.org/screens/jonesy/plinedim.png)

Any advice gratefully received

Many thanks
Tracey :-)
Title: Re: Dimensioning round the bend!
Post by: nivuahc on March 08, 2006, 06:16:38 AM
uhhh... not to my knowledge. Of course, I rarely use dimensions, so, don't take my word for it.

Think of it from a fabricators point of view, though. Let's pretend this is a pipe... when you bend a pipe, it stretches a bit. So, in order for them to know what size pipe to start with, giving them the total length, bend/curve included, would be misleading. Giving them the length to the point of the bend, the radius of the bend, and the distance of the bend, would give them more accurate information to go by.
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 06:28:26 AM
uhhh... not to my knowledge. Of course, I rarely use dimensions, so, don't take my word for it.

Think of it from a fabricators point of view, though. Let's pretend this is a pipe... when you bend a pipe, it stretches a bit. So, in order for them to know what size pipe to start with, giving them the total length, bend/curve included, would be misleading. Giving them the length to the point of the bend, the radius of the bend, and the distance of the bend, would give them more accurate information to go by.

This is for kerbing, what they want is the total distance of that type of Kerb, I to dont need to do too much dimensioning, so I didnt know whether it was possible or not
Title: Re: Dimensioning round the bend!
Post by: nivuahc on March 08, 2006, 06:34:40 AM
Kerbing? Who's he? :)

Anyway, do a list on the pline, does it give you a total length? If so, just attach a leader with the total length on it. That's what I would do, anyway. Actually, I'd probably still dimension it all out, like I mentioned above, then I'd attach the leader.  :oops:
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 06:47:47 AM
Thats similar to what I've been doing in the past, but one engineer wants to see dimensions. Theres no way I'm overriding or exploding dimensions just to get the look they want
Title: Re: Dimensioning round the bend!
Post by: nivuahc on March 08, 2006, 06:57:24 AM
good for you! :-)

Tell him to go back to Engineering 101 and see how it's supposed to be done  :wink:
Title: Re: Dimensioning round the bend!
Post by: Jürg Menzi on March 08, 2006, 07:16:43 AM
Hi Jonesy

Not exactly what you are looking for, but maybe helpful:
Here (http://www.theswamp.org/lilly_pond/index.php?dir=juergmenzi/&file=PolyDim.lsp)
Title: Re: Dimensioning round the bend!
Post by: nivuahc on March 08, 2006, 07:19:10 AM
ooooo... I gotta try that one out!

Thanks Jürg!
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 07:27:52 AM
Will try that out.

Thanks Jurg
Title: Re: Dimensioning round the bend!
Post by: whdjr on March 08, 2006, 08:29:19 AM
Tracey,

This won't help you now but Acad 2006 included a dimarc command.  It only dimensions the arc though and not the line too.
Title: Re: Dimensioning round the bend!
Post by: whdjr on March 08, 2006, 08:37:21 AM
Tracey,

Leonid Nemirovsky has two versions at his site.

<=2004  -  dimarc (http://home.pacifier.com/~nemi/dimarc.htm)
  =2005  -  adim (http://home.pacifier.com/~nemi/adim.htm)
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 08:37:51 AM
Thanks Will, I've only just been upgraded to 2005, so theres no chance of 2006 until "corporate" decide to.

Just checked out those others, and they are not quite what the engineer wants to see... Why do they always want more :realmad: "But AutoCAD can do THAT surely"
Title: Re: Dimensioning round the bend!
Post by: Jürg Menzi on March 08, 2006, 10:12:13 AM
(...) "But AutoCAD can do THAT surely"
Correct, but it's not that simple...

Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 10:15:04 AM
(...) "But AutoCAD can do THAT surely"
Correct, but it's not that simple...



Thats not me... thats the engineers. They think AutoCAD does everything (and pretty much by itself too!
Title: Re: Dimensioning round the bend!
Post by: LE on March 08, 2006, 11:17:30 AM
Hi Tracey;

I have a start of a routine in visual lisp that might work for what you are looking for, here is the code no time to play to much with this... any of the swamp's might be able to continue with the code, or at least with the idea...

HTH.

Note: requires the file "rwiz_utils.lsp" included here:

http://www.theswamp.org/index.php?topic=8889.0

[inside of the ZIP]

Code: [Select]
(defun C:TST  (/ ename obj   measurement     pt      pm       pm2
       array new_poly p1   p2    p3     p4      block_name
       p0 ss vla_att1)
  (if (and
(setq ename (car (entsel "\nSelect an open polyline: ")))
(setq obj (vlax-ename->vla-object ename))
(eq (vla-get-objectname obj) "AcDbPolyline")
(eq (vla-get-closed obj) :vlax-false))
    (progn

      (setq measurement
     (vlax-curve-getdistatparam
       obj
       (vlax-curve-getendparam obj)))

      (setq pt (getpoint "\nSelect dimension location: "))

      (setq pm (vlax-curve-getpointatdist
obj
(* measurement 0.5)))

      (setq array (vla-offset obj (distance pm pt)))

      (setq new_poly (car (vlax-safearray->list (vlax-variant-value array))))

      (if (not (equal (car (nentselp "" pt)) (vlax-vla-object->ename new_poly)))
(progn
  (vla-delete new_poly)
  (setq array (vla-offset obj (- (distance pm pt))))
  (setq new_poly (car (vlax-safearray->list (vlax-variant-value array))))))

      (vla-put-color new_poly acBlue)

      (setq pm2 (vlax-curve-getpointatdist
  new_poly
  (* measurement 0.5)))

      (setq p1 (vlax-curve-getpointatparam obj (vlax-curve-getstartparam obj)))
      (setq p2 (vlax-curve-getpointatparam obj (vlax-curve-getendparam obj)))

      (setq p3 (vlax-curve-getpointatparam
new_poly
(vlax-curve-getstartparam new_poly)))
      (setq p4 (vlax-curve-getpointatparam new_poly (vlax-curve-getendparam new_poly)))

      (setq vla_line1 (rwiz-addline p1 p3))
      (setq vla_line2 (rwiz-addline p2 p4))

      (setq block_name "*U")

      (vl-catch-all-error-p
(vl-catch-all-apply
  'vla-item
  (list (vla-get-blocks (rwiz-thisdwg)) block_name)))

      (setq p0 (list 0.0 0.0 0.0))

      ;; make an empty selection set
      (setq ss (ssadd))
      ;; pass the objects to selection set
      (ssadd (vlax-vla-object->ename new_poly) ss)
      (ssadd (vlax-vla-object->ename vla_line1) ss)
      (ssadd (vlax-vla-object->ename vla_line2) ss)

      ;; make the block
      (setq vla_block
     (rwiz-addblock
       p1
       ;;(list 0.0 0.0 0.0)
       block_name
       ss
       T))

      ;; make the attribute
      (setq
vla_att1
(vla-addattribute
   vla_block
   0.09375
   acattributemodeverify
   "NUMBER"
   (vlax-3d-point p0)
   "NUM"
   ;;"#"
   (rtos measurement 2)

   ))

      ;; put the attribute on layer 0
      (vla-put-layer vla_att1 "0")
      ;; put the attribute by block
      (vla-put-color vla_att1 acbyblock)

      ;; align the attribute middle center
      (vla-put-alignment vla_att1 acalignmentmiddlecenter)
      ;; not verify the attribute at insertion
      (vla-put-verify vla_att1 :vlax-false)
      ;; put the attribute on his alignment point
      (vla-put-textalignmentpoint vla_att1 (vlax-3d-point p0))

      (rwiz-insertblock
p1
(vla-get-name vla_block)
1
1
1
0.0)

      )))
Title: Re: Dimensioning round the bend!
Post by: jonesy 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 :-)
Title: Re: Dimensioning round the bend!
Post by: t-bear 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!
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 08, 2006, 12:31:45 PM
Thanks Mr Bear, I'll try that one too!

Many thanks
T :-)
Title: Re: Dimensioning round the bend!
Post by: Dinosaur 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 !
Title: Re: Dimensioning round the bend!
Post by: Dent Cermak 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.
Title: Re: Dimensioning round the bend!
Post by: jonesy 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.
Title: Re: Dimensioning round the bend!
Post by: Jürg Menzi on March 09, 2006, 07:23:25 AM
To satisfy your 'designer engineer' I've written a dimensioning function (http://www.theswamp.org/lilly_pond/index.php?dir=juergmenzi/&file=DimPoly.lsp) 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
Title: Re: Dimensioning round the bend!
Post by: jonesy on March 09, 2006, 07:32:00 AM
Thank you very much Mr Menzi, that will help immensely

Tracey :-)
Title: Re: Dimensioning round the bend!
Post by: Jürg Menzi 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.