See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: vlax routine perpendicular lines along polyline.

  1. #11
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: vlax routine perpendicular lines along polyline.

    Quote Originally Posted by richards.64879
    WARNING: vlax-curve-getSecondDeriv returns 0 for lines and line segments.
    Yes, that is good, otherwise you can not separate lines from arcs in a polyline.

    : ) Happy Computing !

    kennet

  2. #12
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: vlax routine perpendicular lines along polyline.

    To the library . . .

    Imagine that a polyline is a path after a running ball,
    so the polyline represents the position, point by point of the ball over time,
    the first derivative would be the speed at any particular point in time,
    vlax-curve-getFirstDeriv returns it as a simply local coordinate
    and the speed-direction vector start local at (0.0 0.0 0.0).

    The second derivative is another directional vector,
    it shows how a force turn the ball to the left or right to make it follow the polyline.
    This force-direction vector is perpendicular to the CURVE and it is NEVER (0.0 0.0 0.0).
    vlax-curve-getSecondDeriv returns it as a simply local coordinate
    and the force-direction vector start local at (0.0 0.0 0.0).

    With straight segments the direction is never changing to the left or right,
    so the second derivative of a LINE segment is ALWAYS (0.0 0.0 0.0).

    Code:
    Example:
    (vl-load-com )
    (setq Ent (entsel "Select the polyline curve : " ) )
    (setq VlaObj (vlax-ename->vla-object (car Ent )) )
    (setq Pt (getpoint "Pick a point on the polyline curve : " ) )
    (setq Param (vlax-curve-getParamAtPoint VlaObj Pt ) )
    (setq AngDeg (* (/ (angle (vlax-curve-getFirstDeriv  VlaObj Param ) '(0.0 0.0 0.0)) pi ) 180 ) ) ; Direction from Pt
    (setq AngDeg (* (/ (angle (vlax-curve-getSecondDeriv VlaObj Param ) '(0.0 0.0 0.0)) pi ) 180 ) ) ; Perpendicular to Pt
    
    (equal (vlax-curve-getSecondDeriv VlaObj Param ) '(0.0 0.0 0.0) ) ; = Line segment
    (not (equal (vlax-curve-getSecondDeriv VlaObj Param ) '(0.0 0.0 0.0)) ) ; = Curve segment
    : ) Happy Computing !

    kennet

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Fillet perpendicular lines
    By Raudel Hinojosa Sr in forum AutoLISP
    Replies: 2
    Last Post: 2015-08-07, 06:40 AM
  2. Looking for routine...Polyline box around a polyline
    By iacevedo270202 in forum AutoLISP
    Replies: 4
    Last Post: 2011-04-06, 06:20 PM
  3. Extension Lines on Arc Length Dimension Always Perpendicular
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2009-02-01, 05:08 PM
  4. Drawing perpendicular to a 3D polyline
    By sbullinger in forum AutoCAD General
    Replies: 12
    Last Post: 2008-08-15, 07:14 PM
  5. Non-parallel/perpendicular grid lines
    By DanielleAnderson in forum Revit Architecture - General
    Replies: 2
    Last Post: 2006-11-16, 07:22 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
  •