Jump to content

Recommended Posts

Posted

I have two alignment i have to know the chainage that the perpendicular offset from first alignment at fixed chainage makes to the second alignment.then what those chainage will be ? Pls help to figure out that.i am attaching one sample drawing.is it possible with lisp or vba?

NEED HELP CHAINAGE OF ALIGNMENT.dwg

Posted

Its know as the Peg & shift, is it possible more than likely, there is a lisp called batter ticks it works out sq off 1 pline to another it would be a good starting point if know one posts an answer. You need to specify the rules ie even chainages plus IP's ? Or just pick point and display or all output as a TXt file ?

 

Manual method is draw line from point on pline to other pline use trim then List pline will give length then undo twice and repeat.

Posted

i need the chainages and points id both together in drawings by vba or lisp.

Posted

Does it mean for instance that you want to select the yellow line ( Polyline ) and get the perpendicular lines coordinate at the intersection point between each others ?

Posted

i want to know the chainage and id of that location where the perpendicular lines coming from yellow line intersects the green line.it should be display in drawing and in textfile.is it possible via vba or lisp?

pls help me

Posted

How'd you come up with the first chainage? Did you use a code for that or manually placed all the text and lines? We can add an option to the original if you have indeed used a lisp program for that.

 

Otherwise tell us the parameters for the second alignment.

Posted

An example two alignments built in to our ARD software. Note 1st CH at 10m spacing plus tp's

Main Alignment CL1

Offset Alignment CL2

 

Pegged Shifted Offset

0.000

10.000

20.000 7.640 57.113

30.000 17.657 56.525

40.000 27.675 55.937

50.000 37.692 55.349

Posted

i did not used any lisp for chainage marking of 1st alignment.i used geotools.i wanted to know the exact chainage of second alignment location where the perpendicular line coming from first alignment crossing the second alignment,if i am using the tools it will mark similarly the second alignment on any fixed interval but it is unable to provide the exact chainage of intersection,then manullly i have to measure the distance of intersection point from near chainage .it is timetaking so i need help for that one.is it possible by vba?in landdesktop i observed that one option was there to trace station offset chainage like that,but there also the user has to click every intersection point.is that possible by one click in vba???????

Posted
You need to specify the rules

 

Like I said in my first post do you just want random pts ie pick point it can be a known chainage eg 10 which has a station marker you can snap to or a list of chainages required. Your dwg seems to be just random pts ? Or do you want to pick pts on second alignment and get chainage from 1st alignment ?

 

Please post a clearer dwg of the task

Posted (edited)

Every 500 units on the yellow polyline you draw a perpendicular line.

Now, you want a list of all the intersections between the green polyline and the perpendicular lines. right?

 

Some questions

- Why is the yellow curve a 3D polyline? The curve is flat; I presume a normal polyline is what you need. Any z-value would make it impossible to find intersects.

- What exactly do you need, what is the end result supposed to be: the white lines, trimmed and/or extendended? The intersections? Do you want a list printed somewhere? ... EDIT: oh yes, you want it exported to a .txt file. That's no problem. What format? Can you show an example of that text file, what the end result could look like, for a few points

- Would you expect the green curve ever to cross/intersect the yellow curve? Then the extend would sometimes be on the other side.

Edited by Emmanuel Delay
Posted (edited)

I think this is what you want.

(If it isn't, it does what my previous post suggests)

 

COMMAND: PERP

 

At the end, look at the command bar: you get a list of the intersection points (of the Xlines with the secondary curve).

I just don't know what your intentions are with those points.

 

(You won't hear from me before monday)

 

;; @file: measure a curved line; every 500 units draw a perpendicular line.  We are looking for the intersection of the perpendicular lines with a second curved line
;; @author: Emmanuel Delay - emmanueldelay@gmail.com
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; resources ...
(vl-load-com)
(setq modelSpace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; main function
(defun perp (dist / curve-obj curve-second points xlines intersections)
 (setq 
   curve-obj (entsel "\n Select a curve:")                             ;; client selects the curved object, to be measured
   curve-second (entsel "\n Select a second curve:")                   ;; client selects the second object;
   points (getMeasurePoints dist curve-obj)                            ;; list of all the points.  From those points we draw the perpendicular lines
   xlines (drawPerpendicularLines points curve-obj curve-second)       ;; Construction lines (xline) 
   intersections (getIntersections xlines curve-second)                ;; returns a list of intersection points
 )
 (princ "\nIntersection points:\n")
 (princ intersections)
)

;; measures a polyline, returns a list of points, all "dist" away from each other, along the curve
(defun getMeasurePoints (dist curve / points needle pt)
 (setq 
   needle dist
   points (list)
   pt nil
 )
 (while (and                                                           ;; repeat while vlax-curve-getPointAtDist keeps finding a new point
     (setq pt (vlax-curve-getPointAtDist (car curve) needle))
     (/= nil pt)
   )
     (setq 
       points (append points (list pt))
     )
     (setq needle (+ needle dist))
 )
 points
)

(defun drawPerpendicularLines (points curve curve-second / i pt p xlines vl-obj x)
 (setq 
   i 0
   xlines (list)
 )
 (repeat (length points)
   (setq pt (nth i points))
   (setq vl-obj (vlax-ename->vla-object (car curve)))
   (setq x 
     (vlax-curve-getParamAtPoint vl-obj
       (setq 
         p (vlax-curve-getClosestPointTo vl-obj pt)
        )
     )
   )
   (setq xlines (append 
     xlines
     (list (drawPerpendicularLine curve curve-second x pt))
   ))
   (setq i (+ i 1))
 )
 xlines
)

(defun drawPerpendicularLine (curve curve-second param pt / deriv PTDERIV ptg xline)
 ;; @see http://cadxp.com/topic/21475-vlax-curve-getfirstderiv/
 (setq deriv (vlax-curve-getFirstDeriv (vlax-ename->vla-object (car curve)) param))
 (setq PTDERIV (mapcar '+ pt deriv))
 ;; get a point, distance 10000.0, angle: perpendicular
 (setq ptg (polar pt (+ (angle pt PTDERIV) (/ pi 2)) 10000.00))
 (setq xline (drawXline ptg pt))
 xline
)

(defun getIntersections (xlines curve-second / i intersects)
 (setq 
   i 0
   intersects (list)
 )
 (repeat (length xlines)
   (setq intersects (append intersects (list
     (vlax-invoke 
       (nth i xlines)
       'IntersectWith 
       (vlax-ename->vla-object (car curve-second)) 
     3)
   )))
   (setq i (+ i 1))
 )
 intersects
)

(defun drawXline (p1 p2)
 (vla-AddXline modelSpace (vlax-3d-point p1) (vlax-3d-point p2))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; command PERP
(defun c:perp ( / )
 (perp 500)
 (princ)
)

Edited by Emmanuel Delay
Posted (edited)
...i wanted to know the exact chainage of second alignment location where the perpendicular line coming from first alignment crossing the second alignment,...

 

(defun c:pso ( / cl1 cl2  d  pt pt2 templine ang spc )
;;;		pBe 30Aug2014		;;;
 	(if (and
      (princ "\nSelect the main alignment")
      (setq cl1 (ssget "_:S" '((0 . "*POLYLINE"))))
      (princ "\nSelect the offset alignment")
      (setq cl2 (ssget "_:S" '((0 . "*POLYLINE"))))
      )
(progn
 [color="blue"] (setq d (cond ((getdist
       (strcat "\nEnter increment value: " " <" (rtos (setq d
             (cond ( d_ ) ( 100.00 ))
           ) 2 2) ">: ")))
   ( d )
 )
     )[/color]
  (setq cl1 (ssname cl1 0)
	cl2 (ssname cl2 0) d_ d)
  (while (setq pt (vlax-curve-getpointatdist cl1 d))
    	(setq ang (angle '(0.0 0.0 0.0)
			 (vlax-curve-getfirstderiv
			   cl1
			   (vlax-curve-getparamatpoint cl1 pt)
			 )
		  )
	)
    	(setq templine	(vlax-invoke (setq spc (vlax-get
                           (vla-get-ActiveLayout
		      (vla-get-ActiveDocument (vlax-get-acad-object )))
                                             'Block)) '[color="blue"]AddXline[/color] pt
	  (polar pt (setq ang (+ ang  (* pi 1.5))) 1))
	)
	(if (setq pt2 (vlax-invoke
			templine
			'IntersectWith
			(vlax-ename->vla-object cl2)
			0
		      )
	    )
	   [color="red"] (vlax-invoke  spc 'Addline pt (list (Car pt2)(cadr pt2)(caddr pt2)))[/color]
	)
    (vla-delete templine)
    (setq d (+ d d_))
    )
  )
  )
  (princ)
  )
(vl-load-com)

 

command: pso

Edited by pBe
Xline in place of Ray / Add default / To account if there are more than one intersection
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...