+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Feb 2012
    Posts
    44

    Default Measure...vlax-curve-getPointAtDist...how to do this?

    Registered forum members do not see this ad.

    Good morning,
    I want to put a "gradation" on a curve (pline, spline, line) - see the attached drawing. And i have no idea how to do it, or if it's possible to do it. "Gradation" is always perpendicular on the curve.L1, L2, D - given values. Any idea? Measure? Vlax-curve-getPointAtDist?
    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
    3,008

    Default

    Regarding the programmatically approach, for sure it can be done. Along the function that you already proposed you will need to look also for the second derivative on insertion point in order to get the local tangent, and therefore the perpendicular on curve.

    Regards,
    Mircea

  3. #3
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Feb 2012
    Posts
    44

    Default

    For the second derivative, which function to use?

  4. #4
    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
    3,008

    Default

    To list the second derivative on a curve at a given location should use vlax-curve-getSecondDeriv.

    I suggest you to check in help the vlax-curve-* functions family.

    Regards,
    Mircea

  5. #5
    Senior Member
    Discipline
    Structural
    Using
    AutoCAD 2011
    Join Date
    Sep 2011
    Location
    Baia Mare, Romania
    Posts
    136

    Default

    Sorry Mircea, I don't think the SecondDeriv is needed. This may help::
    (setq tg (vlax-curve-getFirstDeriv entity param)) will give you the direction of the tangent to curve at param. So the perpendicular direction is (atan (cadr tg) (car tg)) + or - pi/2.

  6. #6
    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
    3,008

    Default

    Stefan, you are entirely right; I stand corrected. Sorry for inconvenience.

    Regards,
    Mircea

  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,633

    Default

    This may get you started , although that I did not get what you wanted specifically .

    Consider this just as an example .

    Code:
    (defun c:TesT (/ ss p2 l d n)
      ;;; Tharwat 21. Feb. 2012 ;;;
      (if (and
            (setq ss (entsel "\n Select a Poly :"))
            (member (cdr (assoc 0 (entget (car ss))))
                    '("LINE" "SPLINE" "LWPOLYLINE" "POLYLINE")
            )
            (setq p2 (1+ (fix (vlax-curve-getendparam (car ss)))))
            (setq l (vlax-curve-getdistatparam (car ss) (- p2 1)))
            (setq d (getdist "\n Specify the distance between points :"))
            (setq n d)
          )
        (progn
          (entmake
            (list '(0 . "POINT")
                  (cons 10 (vlax-curve-getpointatparam (car ss) 0))
            )
          )
          (repeat
            (fix (/ l d))
             (setq pt (vlax-curve-getpointatdist (car ss) d))
             (entmake (list '(0 . "POINT") (cons 10 pt)))
             (setq d (+ n d))
          )
        )
        (princ)
      )
      (princ)
    )
    - 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
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Feb 2012
    Posts
    44

    Default

    I want to compare 2 strings, what function to use?
    (= (cdr (assoc 0 (entget (car(entsel))))) "line") , i select a line and is not working... shoul i use equal, or eq...?

  9. #9
    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,633

    Default

    You should use it like this ..

    and = and eq functions are the same in this case .
    Code:
    (eq (cdr (assoc 0 (entget (car(entsel))))) "LINE")
    Or this ...
    Code:
    (= (cdr (assoc 0 (entget (car(entsel))))) "LINE")
    But all of these are not a good way of programming .

    because if you selected nothing , error would take a place .
    - 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

  10. #10
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Feb 2012
    Posts
    44

    Default

    Registered forum members do not see this ad.

    how to determine start point and endpoint for a spline?

Similar Threads

  1. Looping with Vlax-Curve-GetPointAtDist
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 20th May 2009, 03:34 pm
  2. vlax-curve-isClosed not Working
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 20th Apr 2009, 09:11 pm
  3. vlax-curve-getStartParam .... vlax-curve-getStartPoint
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 19th Jan 2009, 05:28 pm
  4. Curve and VLAX
    By JSA2050 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 8th Nov 2007, 08:31 am
  5. abut vlax-curve in lisp
    By vivekgrs in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 15th Jul 2006, 08:17 am

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