Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Tough Questions - Radius Tick Marks

  1. #1
    Member
    Join Date
    2008-10
    Posts
    34

    Default Tough Questions - Radius Tick Marks

    Tough Questions - Tick Marks


    AutoCAD 2007
    I have a quite a few tough questions/requests and I am currently looking for some
    lisps to solve them. I have been doing some searching online to find the lisps I
    need, and although I have been able to find some stuff, I still have some things
    that I can't seem to find exactly what I am looking for. I would like to take
    the opportunity ahead of time to thank every who views my questions and for any
    help that is given.


    Wondering if anyone knows if there is a way to have Autocad put tick marks at the
    beginning and end of all radius arcs selected. Or if anyone has a lisp routine to do this?
    I have attached a dwg example.
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    2008-10
    Posts
    34

    Default Re: Tough Questions - Radius Tick Marks

    I have been searching for a lisp that does this, and I could not find it. Then when doing a search for a different lisp I randomly found this one. It works very well, the only thing is that it does not work on polylines.

    I am looking to be able to select polylines that contains straight lines and arcs and have the lisp be able to add the tick marks to the ends of each radius within the selected polylines.

    Not sure if anyone knows how to edit the lisp below to enable it to do so, and would be willing to help me. If not, hopefully someone will be able to make us of it the way it is.
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    2008-10
    Posts
    34

    Default Re: Tough Questions - Radius Tick Marks

    In another forum, a member named Ollie was nice enough to write a piece of lisp to add to the "endtick.lsp" I found above, which adds polyline capabilities to the lisp. The only thing is I am not yet familiar with lisp enough to know where to insert it into the "endtick.lsp". Is there anyone who can help me combine the two. Also at the end of this it has a line of text that says "add your tick here" not sure if I need to do anything with that. The endtick.lsp I found uses endtick.dwg.


    Code:
    ;;Not tested
    ;Get ent
    (setq ent (vlax-ename->vla-object (car(entsel))))
    ;get coordinates
    (setq coords (vla-get-coordinates ent))
    ;get vertice count
    ;--There is probably a ubound function to get the limit
    (setq limit (/ (length(vlax-safearray->list(vlax-variant-value coords))) 2))
    ;set counter
    (setq cntr -1)
    (while(< (setq cntr (1+ cntr)) limit)
     (if(/= (vla-getbulge ent limit) 0,0)
        (progn
         ; the cntr value is the index of a bulge if the condition is met
         (setq tickPoint (vla-get-coordinate coords cntr))
         ;add your tick here
        )
      )
    )

    Here is the "endtick.lsp" content
    (In order to use it you must use the "endtick.dwg" as well because it creates the "tick" style drawn.)


    Code:
    ;;; ENDTICK.LSP
    ;;;
    ;;; Copyright 2006 Thomas Gail Haws
    ;;; This program is free software under the terms of the
    ;;; GNU (GNU--acronym for Gnu's Not Unix--sounds like canoe)
    ;;; General Public License as published by the Free Software Foundation,
    ;;; version 2 of the License.
    ;;;
    ;;; You can redistribute this software for any fee or no fee and/or
    ;;; modify it in any way, but it and ANY MODIFICATIONS OR DERIVATIONS
    ;;; continue to be governed by the license, which protects the perpetual
    ;;; availability of the software for free distribution and modification.
    ;;;
    ;;; You CAN'T put this code into any proprietary package.  Read the license.
    ;;;
    ;;; If you improve this software, please make a revision submittal to the
    ;;; copyright owner at www.hawsedc.com.
    ;;;
    ;;; This program is distributed in the hope that it will be useful,
    ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ;;; GNU General Public License on the World Wide Web for more details.
    ;;;
    ;;; DESCRIPTION
    ;;;
    ;;; ENDTICK inserts and aligns the ENDTICK block at the endpoint of every arc or line
    ;;; in a selection set.  It removes duplicate ticks.
    ;;;
    ;;; ENDTICK is useful for surveying and civil engineering plans to demarcate points of
    ;;; curvature, tangency, et cetera.
    ;;;
    ;;; You can make your own ENDTICK block if you prefer some custom shape or size tick.
    ;;; The default ENDTICK block is a one unit long vertical line with its insertion point
    ;;; at its midpoint.  ENDTICK scales the ticks to the dimension text height
    ;;; (dimscale * dimtext), so the default ENDTICK block will look as big as the current
    ;;; dimension text height.
    ;;;
    ;;; Revisions
    ;;; 20060914  TGH   Version 1.0PR released.  3 hrs.  Works only with world UCS and View 
    
    (defun c:ENDTICK () (ENDTICK))
    
    (defun
       ENDTICK
           ;;No global variables.  All the variables should be listed here as local.
           (/        CENPOINT    DS        DT        ENDANG
            ENDPOINT    ENTLIST        ENTNAME    ENTTYPE        I
            MINTICKSEPARATION        RADIUS    SS1        STARTANG
            STARTPOINT    TICKLIST    TS
           )
      ;;Set initial variables
      (setq
        ds (getvar "dimscale")
        dt (getvar "dimtxt")
        ts (* ds dt)
        ;;If endpoints are closer together than the distance given below
        ;; and also aligned angularly closer than the angular difference below,
        ;; ENDTICK only plots the first one of them it finds.
        mintickseparation
         (* ts 0.01)
        ;;In radians.  Setting to some big number like 10 (larger than 2 pi) will remove coincident ticks even with different rotations.
        mintickangulardif
         0.01
      )
      ;;Get selection set from user.  Limit to lines and arcs.
      (setq
        ss1    (ssget '((0 . "LINE,ARC")))
        i    -1
      )
      ;;Get endpoints and orientations from selection set
      (while (setq entname (ssname ss1 (setq i (1+ i))))
        (setq
          entlist
           (entget entname)
          enttype
           (cdr (assoc 0 entlist))
        )
        (cond
          ((= enttype "LINE")
           (setq
         startpoint
          (cdr (assoc 10 entlist))
         endpoint
          (cdr (assoc 11 entlist))
         ticklist
          (ENDTICK-addtolist
            (list startpoint (angle startpoint endpoint))
            ticklist
            mintickseparation
            mintickangulardif
          )
         ticklist
          (ENDTICK-addtolist
            (list
              endpoint
              (angle endpoint startpoint)
            )
            ticklist
            mintickseparation
            mintickangulardif
          )
           )
          )
    
          ((= enttype "ARC")
           (setq
         cenpoint
          (cdr (assoc 10 entlist))
         radius
          (cdr (assoc 40 entlist))
         startang
          (cdr (assoc 50 entlist))
         endang
          (cdr (assoc 51 entlist))
         startpoint
          (polar cenpoint startang radius)
         endpoint
          (polar cenpoint endang radius)
         ticklist
          (ENDTICK-addtolist
            (list startpoint (+ startang (/ pi 2)))
            ticklist
            mintickseparation
            mintickangulardif
          )
         ticklist
          (ENDTICK-addtolist
            (list endpoint (+ endang (/ pi 2)))
            ticklist
            mintickseparation
            mintickangulardif
          )
           )
          )
        )
      )
      (setq auold (getvar "aunits"))
      (setvar "aunits" 3)
      (foreach
         tick ticklist
        (command "._insert" "endtick" (car tick) ts "" (cadr tick))
      )
      (setvar "aunits" auold)
    )
    
    (defun
       ENDTICK-addtolist
                 (tick          ticklist          mintickseparation
                  mintickangulardif              /
                  dupfound          templist          tickcheck
                 )
      ;;Look for duplicates in list
      (setq templist ticklist)
      (while (setq tickcheck (car templist))
        (if    (and
          (< (distance (car tick) (car tickcheck)) mintickseparation)
          (< (abs (- (cadr tick) (cadr tickcheck))) mintickangulardif)
        )
          (setq
        dupfound
         T
        templist
         nil
          )
          (setq templist (cdr templist))
        )
      )
      (if (not dupfound)
        (cons tick ticklist)
        ticklist
      )
    )
    Last edited by johnshar123xx; 2010-01-15 at 01:56 PM.

  4. #4
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Tough Questions - Radius Tick Marks

    Maybe this could work, I've added comments to show what I've added / changed:
    Code:
    ;;; ENDTICK.LSP
    ;;;
    ;;; Copyright 2006 Thomas Gail Haws
    ;;; This program is free software under the terms of the
    ;;; GNU (GNU--acronym for Gnu's Not Unix--sounds like canoe)
    ;;; General Public License as published by the Free Software Foundation,
    ;;; version 2 of the License.
    ;;;
    ;;; You can redistribute this software for any fee or no fee and/or
    ;;; modify it in any way, but it and ANY MODIFICATIONS OR DERIVATIONS
    ;;; continue to be governed by the license, which protects the perpetual
    ;;; availability of the software for free distribution and modification.
    ;;;
    ;;; You CAN'T put this code into any proprietary package.  Read the license.
    ;;;
    ;;; If you improve this software, please make a revision submittal to the
    ;;; copyright owner at www.hawsedc.com.
    ;;;
    ;;; This program is distributed in the hope that it will be useful,
    ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ;;; GNU General Public License on the World Wide Web for more details.
    ;;;
    ;;; DESCRIPTION
    ;;;
    ;;; ENDTICK inserts and aligns the ENDTICK block at the endpoint of every arc or line
    ;;; in a selection set.  It removes duplicate ticks.
    ;;;
    ;;; ENDTICK is useful for surveying and civil engineering plans to demarcate points of
    ;;; curvature, tangency, et cetera.
    ;;;
    ;;; You can make your own ENDTICK block if you prefer some custom shape or size tick.
    ;;; The default ENDTICK block is a one unit long vertical line with its insertion point
    ;;; at its midpoint.  ENDTICK scales the ticks to the dimension text height
    ;;; (dimscale * dimtext), so the default ENDTICK block will look as big as the current
    ;;; dimension text height.
    ;;;
    ;;; Revisions
    ;;; 20060914  TGH   Version 1.0PR released.  3 hrs.  Works only with world UCS and View
    
    ;;; Modified by Irné Barnard on 2010-01-15 to allow for polylines as well, noted with comments starting with IB:
    
    (vl-load-com) ;IB: Ensure VLisp extensions are loaded
    
    (defun c:ENDTICK () (ENDTICK))
    
    (defun ENDTICK ;;No global variables.  All the variables should be listed here as local.
                   (/           CENPOINT    DS          DT          ENDANG      ENDPOINT    ENTLIST     ENTNAME
                    ENTTYPE     I           MINTICKSEPARATION       RADIUS      SS1         STARTANG    STARTPOINT
                    TICKLIST    TS          ENTOBJ ;IB: Added ENTOBJ for ActiveX object reference
                   )
      ;;Set initial variables
      (setq ds                (getvar "dimscale")
            dt                (getvar "dimtxt")
            ts                (* ds dt)
            ;;If endpoints are closer together than the distance given below
            ;; and also aligned angularly closer than the angular difference below,
            ;; ENDTICK only plots the first one of them it finds.
            mintickseparation (* ts 0.01)
            ;;In radians.  Setting to some big number like 10 (larger than 2 pi) will remove coincident ticks even with different rotations.
            mintickangulardif 0.01
      ) ;_ end of setq
      ;;Get selection set from user.  Limit to lines and arcs.
      (setq ss1 (ssget '((0 . "LINE,ARC,LWPOLYLINE,POLYLINE"))) ;IB: Added LWPOLYLINE and POLYLINE
            i   -1
      ) ;_ end of setq
      ;;Get endpoints and orientations from selection set
      (while (setq entname (ssname ss1 (setq i (1+ i))))
        (setq
          entlist (entget entname)
          enttype (cdr (assoc 0 entlist))
        ) ;_ end of setq
        (cond
          ((= enttype "LINE")
           (setq
             startpoint (cdr (assoc 10 entlist))
             endpoint   (cdr (assoc 11 entlist))
             ticklist   (ENDTICK-addtolist
                          (list startpoint (angle startpoint endpoint))
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
             ticklist   (ENDTICK-addtolist
                          (list
                            endpoint
                            (angle endpoint startpoint)
                          ) ;_ end of list
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
           ) ;_ end of setq
          )
    
          ((= enttype "ARC")
           (setq
             cenpoint   (cdr (assoc 10 entlist))
             radius     (cdr (assoc 40 entlist))
             startang   (cdr (assoc 50 entlist))
             endang     (cdr (assoc 51 entlist))
             startpoint (polar cenpoint startang radius)
             endpoint   (polar cenpoint endang radius)
             ticklist   (ENDTICK-addtolist
                          (list startpoint (+ startang (/ pi 2)))
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
             ticklist   (ENDTICK-addtolist
                          (list endpoint (+ endang (/ pi 2)))
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
           ) ;_ end of setq
          )
    
          ;; IB: Section added to do Polyline's
          ((wcmatch enttype "LWPOLYLINE,POLYLINE")
           (setq
             ENTOBJ     (vlax-ename->vla-object entname) ;Get the ActiveX object reference from the ename
             startpoint (vlax-curve-getStartPoint ENTOBJ) ;Get the start point
             endpoint   (vlax-curve-getEndPoint ENTOBJ) ;Get the end point
             startang   (vlax-curve-getStartParam ENTOBJ) ;Get the start angle
             endang     (vlax-curve-getEndParam ENTOBJ) ;Get the end angle
             ticklist   (ENDTICK-addtolist
                          (list startpoint (angle startpoint endpoint))
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
             ticklist   (ENDTICK-addtolist
                          (list
                            endpoint
                            (angle endpoint startpoint)
                          ) ;_ end of list
                          ticklist
                          mintickseparation
                          mintickangulardif
                        ) ;_ end of ENDTICK-addtolist
           ) ;_ end of setq
          ) ;IB: End of section added
        ) ;_ end of cond
      ) ;_ end of while
      (setq auold (getvar "aunits"))
      (setvar "aunits" 3)
      (foreach tick ticklist
        (command "._insert" "endtick" (car tick) ts (Rad2Deg (cadr tick))) ;IB: Added Rad2Deg to convert from Radians to Degrees
      ) ;_ end of foreach
      (setvar "aunits" auold)
    ) ;_ end of defun
    
    ;; IB: Added function to convert Radians to Degrees
    (defun Rad2Deg (Rad /) (* 180.0 (/ Rad pi)))
    
    (defun ENDTICK-addtolist (tick ticklist mintickseparation mintickangulardif / dupfound templist tickcheck)
      ;;Look for duplicates in list
      (setq templist ticklist)
      (while (setq tickcheck (car templist))
        (if (and
              (< (distance (car tick) (car tickcheck)) mintickseparation)
              (< (abs (- (cadr tick) (cadr tickcheck))) mintickangulardif)
            ) ;_ end of and
          (setq
            dupfound
                     T
            templist
                     nil
          ) ;_ end of setq
          (setq templist (cdr templist))
        ) ;_ end of if
      ) ;_ end of while
      (if (not dupfound)
        (cons tick ticklist)
        ticklist
      ) ;_ end of if
    ) ;_ end of defun
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  5. #5
    Member
    Join Date
    2008-10
    Posts
    34

    Default Re: Tough Questions - Radius Tick Marks

    Thank you irneb for your response and for you lisp, it is greatly appreciated.
    At first I just loaded the lisp quickly to give it a try and I was unable to get the lisp to work.
    Then I opened it up to read your comments (which was very helpful to see and learn a little of what needed to be edited) and I read about the need to load the "VL-LOAD-COM, which I am unaware of how to load this.
    I have been doing a little research on how to load this command, and I will post a response once I have learned how to do so, and when I have tested out the lisp you supplied.

    I thank you again for you help and as mentioned I will keep you updated.

  6. #6
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Tough Questions - Radius Tick Marks

    The (vl-load-com) call I've added should be all that's necessary to load the VL Extensions. I've added 5 functions which are part of these VL Extensions:
    • vlax-ename->vla-object
    • vlax-curve-getStartPoint
    • vlax-curve-getStartParam
    • vlax-curve-getEndPoint
    • vlax-curve-getEndParam
    If your AC 2007 can't use these there's something wrong with it's installation. These were definitely available prior to 2007, and forms part of the normal Vanilla AutoCAD installation.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  7. #7
    Member
    Join Date
    2008-10
    Posts
    34

    Default Re: Tough Questions - Radius Tick Marks

    Again I thank you irneb for your help, unfortunately I am still having some trouble.
    I created a completely new drawing and in it I drew a polyline composed of a two straight lines connected by a radius. I tried loading the lisp in this new drawing, and I now don't get the vl load error, but the lisp just puts one large tick mark at the beginning of the polyline and it asks the rotation for it. I can't seem to get the lisp to react like the "endtick.lisp" I supplied, where it automatically puts the ticks at the ends of the each radius, and the ticks are automatically cross the perpendicular to the polyline.

    If you are unable to get it to work, that is fine, I really appreciate your help in trying to come up with a solution for me.

  8. #8
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Tough Questions - Radius Tick Marks

    It depends on the version of ACad. I'm using Vanilla 2008 at the moment, I know there was some changes prior and after 2008, so that may be why yours is not working correctly. Check the (command "._insert" "endtick" line, and compare it to the prompts you'd give after an -INSERT command (note hyphen prefix to not use the dialog). That's probably where the difference comes in.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  9. #9
    Member
    Join Date
    2008-10
    Posts
    34

    Default Re: Tough Questions - Radius Tick Marks

    Hey irneb, thanks again for getting back to me, I had someone I work with try it in AutoCAD 2008 and he got the same effect as I did, where it tries putting just one giant tickmark at the end of the polyline (asking for a rotation angle) instead of a small tickmark block at the ends of every radius automatically.

    I would mainly use this lisp in civil plans where units are set to decimal and the ltscale is usually set to around 40.00 (for a 40 scale drawing)

    Below is what the lisp reads when entered in the command line

    Command: endtick
    Select objects: 1 found
    Select objects:
    ._insert Enter block name or [?] <endtick>: endtick
    Units: Feet Conversion: 1.0000
    Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate]:
    Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>:
    7.200000000000000 Enter Y scale factor <use X scale factor>: 315.0000000000000
    Specify rotation angle <0r>: ._insert
    Requires valid numeric angle or second point.
    ; error: Function cancelled
    Specify rotation angle <0r>:

    I also found this lisp below that maybe can help as well, or maybe someone else can use it as is. It is pretty cool, meant for pipes. The reason why I figured it may be helpful is that it places lines at the ends of radii, but unfortunately the tickmarks lines are not blocks.

    Again thank you
    Attached Files Attached Files

  10. #10
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Tough Questions - Radius Tick Marks

    Oh sorry, I think I see where the problem is: If the block was defined with uniform scaling it doesn't ask for Y. And I used a uniform block to test the code. For a non-uniform scaled block the command call should look like this:
    Code:
    (command "._insert" "endtick" (car tick) ts "" (Rad2Deg (cadr tick)))
    Notice the empty string which means an Enter key when asked for the Y scale factor. You could have sent the ts again, but it does the same thing.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

Page 1 of 2 12 LastLast

Similar Threads

  1. Tick Marks
    By David Donaldson in forum Revit Architecture - General
    Replies: 3
    Last Post: 2010-06-09, 05:03 PM
  2. Wiring Tick Marks
    By mparks.161070 in forum AMEP General
    Replies: 12
    Last Post: 2009-06-18, 04:08 PM
  3. Wire Tick Marks
    By ddaukas in forum Revit MEP - Families
    Replies: 4
    Last Post: 2007-05-09, 07:10 PM
  4. TICK MARKS
    By philipnoland in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-08-22, 11:57 PM

Posting Permissions

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