+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    May 2009
    Posts
    21

    Default Autodimensioning arc's pline segment(s)

    Registered forum members do not see this ad.

    Hi all,

    How can i use the command DIMARC on all arc's polyline segment(s) without picking the segment(s) and dimension location?
    One more thing the dimensions have to be associative's.
    Thank you for any helps.

    M4rdy.
    Autocad 2007

  2. #2
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,588

    Default

    Quote Originally Posted by m4rdy View Post
    Hi all,

    How can i use the command DIMARC on all arc's polyline segment(s) without picking the segment(s) and dimension location?
    One more thing the dimensions have to be associative's.
    Thank you for any helps.

    M4rdy.
    Autocad 2007
    Mardi,
    This one is from my oldies
    Is this what you looking for?
    (Check your PM box)

    Code:
    ;; Program to dimensioning all polyline segments
    ;;  fixo () 2005 all rights removed
    ;; A2005 / Windows XP
    
    
    ;; helper functions : written by Fatty T.O.H.
    
    ;; ***  group list   ***
    
    (defun group-by-num (lst num / ls ret)
      (if (= (rem (length lst) num ) 0)
        (progn
          (setq ls nil)
          (repeat (/ (length lst) num)
    	(repeat num (setq ls 
    		    (cons (car lst) ls)
    	      lst (cdr lst)))
    	(setq ret (append ret (list (reverse ls)))
    	      ls nil)))
        )
    ret
      )
    
    ;; ***  coordinates  ***
    
    (defun get-vexs (pline_obj / verts)
          (setq verts (vlax-get pline_obj 'Coordinates)
    	    verts
    		  (cond
    		    ((wcmatch (vlax-get pline_obj 'Objectname )
    			     "AcDb2dPolyline,AcDb3dPolyline") 
    		     (group-by-num verts 3)
    		    )
    		    ((eq (vlax-get pline_obj 'Objectname )
    			     "AcDbPolyline") 
    		     (group-by-num verts 2)
    		    )
    		    (T nil)
    		  )
    )
      ) 
    
    
    ;; ***  inclined angle  ***
    
    (defun dif-angle (ang1 ang2 / def)
      (set 'ang1
           (if (> ang2 (+ pi ang1))
    	 (+ (* pi 2) ang1)
    	 ang1
           )
      )
      (set 'ang2
           (if (> ang1 (+ pi ang2))
    	 (+ (* pi 2) ang2)
    	 ang2
           )
      )
      (setq def (- ang2 ang1))
    )
    
    ;; ***  test on CW/CCW  ***
    ;; (angdir=0)
    (defun ccw-test	(pt_list / angle_list)
      (setq	angle_list
    	 (mapcar (function (lambda (x y)
    			     (angle x y)
    			   )
    		 )
    		 pt_list
    		 (cdr pt_list)
    	 )
      )
      (if (> (apply	'+
    		(mapcar	(function (lambda (x y) (dif-angle x y)))
    			angle_list
    			(cdr angle_list)
    		)
    	 )
    	 0
          )
        t
        nil
      )
    )
    ;; ***  main programm  ***
    
    (defun C:dmp (/ )
      (vl-load-com)
      (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
      (setq acsp (vla-get-modelspace adoc))
      (setq	pl (vlax-ename->vla-object
    	     (car (entsel "\n >> Select pline >> \n"))
    	   )
      )
    
    (setq	coords (get-vexs pl))
      (if (eq :vlax-true (vla-get-closed pl))
      (setq	coords (append coords (list (car coords)))))
      (if (ccw-test coords)(setq dop pi)(setq dop 0)) 
    
    (setq param_list (mapcar (function (lambda (x)
    		(fix (vlax-curve-getparamatpoint pl x))))
          (mapcar (function (lambda (y)(trans y 0 1))) coords)))
    (mapcar (function (lambda (x y z)  
    (cond
    ((not (zerop (setq blg (vla-getbulge pl x))))
    (progn
    (setq hgt (* 4 (atan (abs blg)))
    chord (distance y z)
    rad (abs (/ chord 2 (sin (/ hgt 2))))
    mid (trans (vlax-curve-getpointatparam pl (+ (fix x) 0.5)) 0 1)
    ;;;cen (trans (mapcar (function (lambda (a b)(/ (+ a b) 2))) y z) 0 1)
    ;; fixed by Matthew :      
    cen (trans (polar y (if (minusp blg)(-(angle y z)(-(/ pi 2)(/ hgt 2)))
    		      (+(angle y z)(-(/ pi 2)(/ hgt 2)))) rad) 0 1) 
    txp (trans (polar mid (if (minusp blg)(angle cen mid)
    			(angle mid cen)) 8) 0 1)
    )
    (setq dm (vla-adddim3pointangular acsp
    	   (vlax-3d-point cen)
    	   (vlax-3d-point y)
    	   (vlax-3d-point z)
    	   (vlax-3d-point txp)))
    (vla-put-textoverride dm (rtos (abs (- (vlax-curve-getdistatpoint pl y)
    			       (vlax-curve-getdistatpoint pl z))) 2 2)))
    )
    (T (progn
         (setq mid (trans (vlax-curve-getpointatparam pl (+ (fix x) 0.5)) 0 1))
         (setq txp (trans (polar mid (+ dop (angle y z) (/ pi 2)) 8.) 0 1))
         (vla-adddimaligned acsp 
    	   (vlax-3d-point y)
    	   (vlax-3d-point z)
    	   (vlax-3d-point txp))
         
    )
    ))))
    param_list
    	coords
    	(cdr coords))
    	
      (princ)
    )
    
    (princ "\n\t***\tPLINE DIMENSIONING\t***\n")
    (princ "\nType DMP to execute\n")
    (prin1)
    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  3. #3
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    May 2009
    Posts
    21

    Default

    Thank you FIXO for your reply.
    Is this what you looking for?
    Yes, indeed i had your DMP's. But as i posted before, is it possible to make the dimensions to be associative's?

  4. #4
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    May 2009
    Posts
    21

    Default

    And one more thing, i found error on different UCS angle.
    Command: DMP
    >> Select pline >>
    ; error: bad argument type: numberp: nil

    M4rdy

  5. #5
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,588

    Default

    Quote Originally Posted by m4rdy View Post
    And one more thing, i found error on different UCS angle.
    Command: DMP
    >> Select pline >>
    ; error: bad argument type: numberp: nil

    M4rdy
    I wrote it many moons ago for WCS only
    Ok I will see what I can to rewrite for different UCS
    Easier yet to set world / restore current UCS btw

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  6. #6
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,588

    Default

    Quote Originally Posted by m4rdy View Post
    And one more thing, i found error on different UCS angle.
    Command: DMP
    >> Select pline >>
    ; error: bad argument type: numberp: nil

    M4rdy
    Hi Mardy
    I figured out how to get it to work in the different UCS
    just added few lines of code
    Let me know how it will be work

    ~'J'~
    Attached Files
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  7. #7
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    May 2009
    Posts
    21

    Default

    It works perfectly. Just curious, why do you use dimangular (vla-adddim3pointangular) then override the text for arc segments? I've tried to use dimarc, but i had no luck. What's wrong with that?
    Thank you sir.

    m4rdy

  8. #8
    Senior Member wizman's Avatar
    Using
    AutoCAD 2009
    Join Date
    Nov 2007
    Location
    Abu Dhabi / Philippines
    Posts
    408

    Default

    (acdimenableupdate T) <-------[ Thanks for this Fixo..'-)

  9. #9
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    May 2009
    Posts
    21

    Default Autodimensioning arc's pline segment(s)

    Wait a minute...FIXO i have a little problem with your dmp. If the arc segment as the last segment on closed pline, the result goes wrong.

    (acdimenableupdate T) <-------[ Thanks for this Fixo..'-)
    Hi Wizman,
    How are you doing?
    Did you finish your 'future addition'?
    I see (acdimenableupdate T) works for STRETCH command, but it doesn't for GRIP edit.

    m4rdy
    Attached Images

  10. #10
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,588

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by m4rdy View Post
    Wait a minute...FIXO i have a little problem with your dmp. If the arc segment as the last segment on closed pline, the result goes wrong.

    Hi Wizman,
    How are you doing?
    Did you finish your 'future addition'?
    I see (acdimenableupdate T) works for STRETCH command, but it doesn't for GRIP edit.

    m4rdy
    Ok, I will try

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Similar Threads

  1. Help w/ Arc's, Circles, mine look jagged
    By TREX in forum AutoCAD Beginners' Area
    Replies: 10
    Last Post: 13th Jan 2009, 01:17 am
  2. How to make a segment of line invisibility?
    By Super_geni in forum AutoCAD General
    Replies: 2
    Last Post: 3rd Oct 2007, 05:28 pm
  3. Segment Arc Polyline?
    By JaketheMan in forum AutoCAD General
    Replies: 13
    Last Post: 27th Aug 2007, 03:46 pm
  4. Rotating (2)arc's to a Mid-point
    By JaketheMan in forum AutoCAD General
    Replies: 7
    Last Post: 2nd May 2007, 07:22 pm
  5. Line segment
    By johnengineer in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 23rd Mar 2007, 04:35 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts