Author Topic: place lines on pline with a specific distance  (Read 2893 times)

0 Members and 1 Guest are viewing this topic.

SAT

  • Guest
place lines on pline with a specific distance
« on: July 22, 2004, 09:32:44 AM »
hello all,

I want to place perpedicular lines along the pline from the midpoint with a specified distance.
I there any genaric function for that.
from mid point I started placing lines but when it goes to imediate vertex in polyline the angle is changing. How to deal that any ideas.

SpeedCAD

  • Guest
Re: place lines on pline with a specific distance
« Reply #1 on: July 22, 2004, 09:50:33 PM »
Quote from: SAT
hello all,

I want to place perpedicular lines along the pline from the midpoint with a specified distance.
I there any genaric function for that.
from mid point I started placing lines but when it goes to imediate vertex in polyline the angle is changing. How to deal that any ideas.


Hello...

You have prove with DIVIDE command or MEASURE command?.

sinc

  • Guest
place lines on pline with a specific distance
« Reply #2 on: July 22, 2004, 11:34:58 PM »
Here's part of what you need, from another routine I'm working on.  It returns the coordinate of a point a given distance to one side of any point on any object.  To use, simply call as follows:

(uc:offsetInDir entname point dir offDist)

where:

entname is the entity name of the polyline (or other entity)
point is the incident point on the polyline (or other entity)
dir is which side to offset
offDist is the distance

Direction is based on the fact that entities have a start point and an end point.  The direction of the entity is this direction, along the path of the entity from start point to end point.  If you call the routine with dir=-1, it will calculate an offset on the right side of the line (i.e., direction to the offset point is 90 degrees clockwise from the direction of the line); if dir=1, it creates the offset on the left side (counter-clockwise from the direction of the line).

It's up to you to add the code that interacts with the user, and figures what distances to go along the polyline.

Code: [Select]

(vl-load-com)

(setq QUAD (/ PI 2)) ; radians in a quadrant

(defun uc:azimuthAtParam (entname selPar / dvec)
  (setq dvec (vlax-curve-getFirstDeriv entname selPar))
  (angle '(0 0) dvec)
  ;; note: angle projected on xy plane
) ;defun uc:azimuthAtParam


 ; value of dir: -1 = clockwise (rt), 1 = counterclockwise (lt)
(defun uc:offsetInDir (entname point dir offDist / ang par)
  (if (= offDist 0)
    (append point)
    (progn
      (setq par (vlax-curve-getParamAtPoint entname point)
   ang (+ (* dir QUAD) (uc:azimuthAtParam entname par))
      ) ;setq
      (polar point ang offDist)
    ) ;progn
  ) ;if
) ;defun uc:offsetInDir