+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23
  1. #1
    Full Member satishrajdev's Avatar
    Discipline
    Surveying
    Using
    AutoCAD 2007
    Join Date
    Apr 2012
    Location
    Aamchi Mumbai, India
    Posts
    85

    Default Multiple Offsets

    Registered forum members do not see this ad.

    Hi all,
    as i shown in the drawings, i have centerlines and winglines,
    now what i want is from centerline i want to draw winglines at different distances
    (i.e.10m,25m,45m it could be any distance means not ON proper interval)
    and corridor at the end
    Is there any lisp that could solve my prob.

    Thankx a lot in advance
    Attached Files

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    An alternative solution is to draw that as multiline after define an apropriate style.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,616

    Default

    Try this piece of code .

    Code:
    (defun c:Test (/ *error* d e s k)
      (vl-load-com)
    ;;; Tharwat 09. Oct. 2012 ;;;
      (defun *error* (x)
        (princ "\n*Cancel*")
      )
      (if (and (not (tblsearch "LAYER" "SURVEY LIMIT"))
               (not (tblsearch "LAYER" "SURVEY LINES"))
          )
        (progn
          (alert " One or two layers [SURVEY LIMIT , SURVEY LINES] are not found in the drawing")
          (exit)
        )
      )
      (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE"))))
               (progn
                 (initget "WINGLINES CORRIDOR")
                 (setq k
                        (cond ((getkword
                                 "\n Choose one [Winglines/Corridor] <Winglines> :"
                               )
                              )
                              ("Winglines")
                        )
                 )
               )
          )
        (while
          (setq d (getdist "\n Specify offset distance :"))
           (progn
             (foreach x (list d (- d))
               (vla-offset
                 (vlax-ename->vla-object (ssname s 0))
                 x
               )
               (vla-put-layer
                 (vlax-ename->vla-object (entlast))
                 (if (eq k "Winglines")
                   "SURVEY LIMIT"
                   "SURVEY LINES"
                 )
               )
             )
           )
        )
      )
      (princ)
    )
    Last edited by Tharwat; 9th Oct 2012 at 10:30 am. Reason: name of layers added to alert function
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  4. #4
    Full Member satishrajdev's Avatar
    Discipline
    Surveying
    Using
    AutoCAD 2007
    Join Date
    Apr 2012
    Location
    Aamchi Mumbai, India
    Posts
    85

    Default

    OMG......Thanx a lot tharwat
    that is working beautifully...........but still need little correction
    when i m trying to draw corridor, the line which is drawn must have corridor line properties (i.e. Layer-Survey limit, Color-Blue, Line type-dashed)
    but corridor it draws has wingline properties (i.e. Layer-Survey lines, Color-magenta, Line type-conti.)

    other than this it is working fabulously.....This what i was looking for

  5. #5
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,616

    Default

    Quote Originally Posted by satishrajdev View Post
    OMG......Thanx a lot tharwat
    that is working beautifully...
    You're welcome .

    Quote Originally Posted by satishrajdev View Post
    when i m trying to draw corridor, the line which is drawn must have corridor line properties (i.e. Layer-Survey limit, Color-Blue, Line type-dashed)
    but corridor it draws has wingline properties (i.e. Layer-Survey lines, Color-magenta, Line type-conti.)
    It does that , and when you have the prompt of [Winglines/Corridor] , just enter Corridor or the first letter C is enough .
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  6. #6
    Full Member satishrajdev's Avatar
    Discipline
    Surveying
    Using
    AutoCAD 2007
    Join Date
    Apr 2012
    Location
    Aamchi Mumbai, India
    Posts
    85

    Default

    i tried that...
    i entered C after that prompt but still magenta line is appearing
    can u tell why it is happening?

    i have modified this routine, which is as follow
    Code:
    (defun c:Test (/ *error* d e s k)
      (vl-load-com)
    ;;; Tharwat 09. Oct. 2012 ;;;
      (defun *error* (x)
        (princ "\n*Cancel*")
      )
      (if (and (not (tblsearch "LAYER" "SURVEY LIMIT"))
               (not (tblsearch "LAYER" "SURVEY LINES"))
          )
    (command "layer" "m" "Survey Limit" "lt" "dashed" "" "c" "5" "" "")
    (command "layer" "m" "Survey Lines" "lt" "continuous" "" "c" "6" "" "")
      )
      (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE"))))
               (progn
                 (initget "WINGLINES CORRIDOR")
                 (setq k
                        (cond ((getkword
                                 "\n Choose one [Winglines/Corridor] <Winglines> :"
                               )
                              )
                              ("Winglines")
                        )
                 )
               )
          )
        (while
          (setq d (getdist "\n Specify offset distance :"))
           (progn
             (foreach x (list d (- d))
               (vla-offset
                 (vlax-ename->vla-object (ssname s 0))
                 x
               )
               (vla-put-layer
                 (vlax-ename->vla-object (entlast))
                 (if (eq k "Winglines")
                   "SURVEY LIMIT"
                   "SURVEY LINES"
                 )
               )
             )
           )
        )
      )
      (princ)
    )
    but still same error is coming

  7. #7
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,616

    Default

    Quote Originally Posted by satishrajdev View Post
    i entered C after that prompt but still magenta line is appearing
    can u tell why it is happening?
    Check the Color Control of the current layer , it might be changed to others than ByLayer .
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  8. #8
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    Code:
    (defun c:Test (/ *error* d e s k)
      (vl-load-com)
    ;;; Tharwat 09. Oct. 2012 ;;;
      (defun *error* (x)
        (princ "\n*Cancel*")
      )
    (setvar 'cmdecho 0)  
    (defun Lyr (/ x)
         (initget "WINGLINES CORRIDOR")
         (setq x
                (cond ((getkword
                         "\n Choose one [Winglines/Corridor] <Winglines> :"
                       )
                      )
                      ("Winglines")
                )
         ) x
       )
    (foreach lyr '(("SURVEY LIMIT" "5" "DASHED")
    	       ("SURVEY LINES" "6" "CONTINUOUS"))
      	(if (not (tblsearch "LAYER" (car lyr)))
    	 	(command "_Layer" "_N"
    			 (car lyr)  "_Color"
    			 (cadr lyr) (car lyr)
    			 "_Ltype"
    			 (last lyr) (car lyr)
    			 ""
    		)))
    	     
      (if (and (setq s (ssget "_+.:S:L" '((0 . "LINE"))))
               (setq k (lyr))
          )
        (while
          (progn (initget "L")
          (setq d (getdist "\n Specify offset distance/L To change layer :")))
    		(cond
    		  ((eq d "L")(setq k (lyr)))	
          		  ((eq (Type d) 'Real) 
    		         (foreach x (list d (- d))
    		           (vla-offset
    		             (vlax-ename->vla-object (ssname s 0))
    		             x
    		           )
    		           (vla-put-layer
    		             (vlax-ename->vla-object (entlast))
    		             (if (eq k "Winglines")
    		               "SURVEY LIMIT"
    		               "SURVEY LINES"
    		             )
    		           )
    		         )
    		   )
           )
        )
      )
      (princ)
    )

  9. #9
    Full Member satishrajdev's Avatar
    Discipline
    Surveying
    Using
    AutoCAD 2007
    Join Date
    Apr 2012
    Location
    Aamchi Mumbai, India
    Posts
    85

    Default

    it working perfectly now for me without any error

    @pBe and Tharwat.....you guys are real genius.... thankx a lot for your interest and help..... your work is really appreciated.

    I want one more help from u (Sorry for making u to work again)

    In winglines segment, i want the prompt of Specify Distance [Same/Different]
    1. at same distance i want to specify distance once and then it should draw line at proper interval of that distance.
    (e.g. If i specified distance 2 then
    1st offset will be @- 2,
    2nd offset will be @- 4,
    3rd offset will be @- 6.

    Just like Offset command (after selecting object it ask Specify through point or [Exit/Multiple/Undo] <Exit>:
    When we give Multiple command it draws line at proper interval of that specified distance)

    2.For different distance it should work how it is working now.
    i.Select object
    ii. specify distance
    iii. offsetting the line

  10. #10
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    Registered forum members do not see this ad.

    That sounds like fun. But its tharwats' code really

    Cheers

Similar Threads

  1. Offsets
    By igones in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 15th May 2012, 04:54 am
  2. Annotation Offsets
    By magic_man1 in forum Revit General
    Replies: 1
    Last Post: 24th May 2011, 12:25 am
  3. Roofplan offsets...Need help!!!
    By truedud in forum AutoCAD Beginners' Area
    Replies: 15
    Last Post: 17th Oct 2010, 08:27 pm
  4. dim line offsets??
    By comcu in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 4th May 2007, 05:48 pm
  5. Bays, offsets?
    By James in forum SketchUp
    Replies: 4
    Last Post: 16th Jan 2007, 11:54 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