Author Topic: Intersection of 2 polylines  (Read 12436 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Intersection of 2 polylines
« Reply #15 on: January 19, 2010, 01:42:02 PM »
ozimad,
Please post a DWG with the Before and After.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ozimad

  • Guest
Re: Intersection of 2 polylines
« Reply #16 on: January 20, 2010, 02:21:01 AM »
Well OK here is the dwg.
+ the real problem is that is not always a strait polyline it can have arc inside.
The code has a lot of things that can be faster, but it works and it is correct and precise, and i have to do this routine 10 times a day so i do not care if it is enough quick to run in 1000 times a day.


(defun c:jpp()
(setq primitiv (ssget)) ;;; select the base line
(setq pt1 (getpoint "\Specify side"))
(setq bp (getreal"\Paplasinajuma joslas platums")) ;;;first number it can be 3,5 fir example
(setq dist (getreal"\Paplasinajuma joslas garums")) ;;; this need to be 50 by the dwg i posted

;;;here i do an offset job and getting all the lines in future to delete them
(command "_.offset" (* bp 0.02) primitiv pt1 "e")
(setq primitiv2 (ssget "l"))
(command "_.offset" (* bp 0.08) primitiv pt1 "e")
(setq primitiv3 (ssget "l"))
(command "_.offset" (* bp 0.18) primitiv pt1 "e")
(setq primitiv4 (ssget "l"))
(command "_.offset" (* bp 0.32) primitiv pt1 "e")
(setq primitiv5 (ssget "l"))
(command "_.offset" (* bp 0.5) primitiv pt1 "e")
(setq primitiv6 (ssget "l"))
(command "_.offset" (* bp 0.68) primitiv pt1 "e")
(setq primitiv7 (ssget "l"))
(command "_.offset" (* bp 0.82) primitiv pt1 "e")
(setq primitiv8 (ssget "l"))
(command "_.offset" (* bp 0.92) primitiv pt1 "e")
(setq primitiv9 (ssget "l"))
(command "_.offset" (* bp 0.98) primitiv pt1 "e")
(setq primitiv10 (ssget "l"))
(command "_.offset" bp primitiv pt1 e)
(setq primitiv11 (ssget "l"))
(command "_.measure" primitiv "b" "help1" "y" (* dist 0.1))

;;; this is the code for getting crossing blocks, exploding them, and finding the intersection lines
(setq skers (ssget "l"))
(command "_.explode" skers)
(setq skers (ssget "l"))
(command "_test1" skers primitiv )



;;;here is the place for the finding the intersection points, i do not need a loop hear i can do the command 10 times and it is ok for me



;;;here i simply delete all the polylines, this part works
;(command "_.erase" primitiv2 "")
;(command "_.erase" primitiv3 "")
;(command "_.erase" primitiv4 "")
;(command "_.erase" primitiv5 "")
;(command "_.erase" primitiv6 "")
;(command "_.erase" primitiv7 "")
;(command "_.erase" primitiv8 "")
;(command "_.erase" primitiv9 "")
;(command "_.erase" primitiv10 "")
;(command "_.erase" primitiv11 "")


(princ)
)

Thanks for your help, i have nobody to help me with Lisp in Latvia. In lisp way we are in stone age here  :lmao:

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Intersection of 2 polylines
« Reply #17 on: January 20, 2010, 03:51:04 AM »
Quote
Thanks for your help, i have nobody to help me with Lisp in Latvia. In lisp way we are in stone age here
from time to time you may come across lisp codes entitled like this
Code: [Select]
;;  V1.0, 14th Julay 2007, Riga, Latvia                                 ;;
;;  © Aleksandr Smirnov (ASMI)                                          ;;
so things are not that bad in Latvia

ozimad

  • Guest
Re: Intersection of 2 polylines
« Reply #18 on: January 20, 2010, 07:11:07 AM »
Another question I have as i am using autocad civil I have transparent commands in it. I want to attach to aligment polyline, in autocad i write "pl" and starting polyline i write "'so" and i can attach my polyline to aligment, but using lisp i cannot call "'so". Any ideas:

_.pline
Specify start point: '_so
Invalid point.
; error: Function cancelled

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Intersection of 2 polylines
« Reply #19 on: January 20, 2010, 12:03:32 PM »
Well OK here is the dwg.
+ the real problem is that is not always a strait polyline it can have arc inside.
The code has a lot of things that can be faster, but it works and it is correct and precise, and i have to do this routine 10 times a day so i do not care if it is enough quick to run in 1000 times a day.

I looked at your Drawing & your LISP but can not figure out how you are using the lisp to get the new objects in the drawing.
First there are no LINES, just polylines.
I need more information.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ozimad

  • Guest
Re: Intersection of 2 polylines
« Reply #20 on: January 21, 2010, 03:33:22 AM »
Hey, I decided to change the concept of my lisp. Now I know how i can get without intersection points. I will use aligment and tranparent commands.  8-)
I want to bulid a road with the additional slowing line. I allways have an aligment so i want to use it, the concept is i do not need to do the geometry intersection points finding, just simple maths. I use pline=>'so command to find the point coordinate, My code now looks like that.

(defun c:papl ()
(vl-load-com)
(setq al (ssget))
(command "_.so" al "10" "0")
(princ)
)
 
in console it gives me


Command:  PAPL
Select objects: 1 found
Select objects:  _.so
Select alignment:
Specify station: 10
Specify station offset: 0
Command:
Command: (21.9795 19.8182 0.0) ;;;i need to get that point and use it in building polyline

Can somebody help me with getting the point, thanks!


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Intersection of 2 polylines
« Reply #21 on: January 21, 2010, 09:12:08 AM »
If you want the user to pick the point use (getpoint)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ozimad

  • Guest
Re: Intersection of 2 polylines
« Reply #22 on: January 23, 2010, 02:12:37 AM »
I want the _.pline to pick that point,

I have some aligment and i need to build the polyline in for exp. station 10 offset 10, and station 20 offset 30. But i cannot call the tranparent command troug the pliine command. or calling i the transparent command i cannot get the point to pline.

Lerner

  • Newt
  • Posts: 33
Re: Intersection of 2 polylines
« Reply #23 on: January 23, 2010, 03:42:46 AM »
ozimad,
I'm not sure what you are trying to do exactly but from your drawing polycross.dwg it looks like you want the curve of a line around a cylinder. If so, this is just the sine function, which you can draw with my program Sin. Use "starting Phase" of 90, then select points at each end of the axis of the cylinder in side view. For "Length of one cycle" either type in 100 for the dimensions used in your drawing, or select the "Cycles" option and type in 0.5. For Amplitude select the cylinder radius.
« Last Edit: January 23, 2010, 06:48:47 AM by Lerner »

ozimad

  • Guest
Re: Intersection of 2 polylines
« Reply #24 on: April 06, 2010, 04:16:11 AM »
So its been a long time till i come here. Now I understand something and i can say that the problem was in my stupidness, no vla object id was made before trying find the intersection points but. I found something there important for me end may be for some one else.  If you need to find intersection point for 2 arcs, it will give you 2 point, in order to get only one and correct you need to use
(vla-IntersectWith pl1 pl2 acExtendThisEntity)
anyway thanks everybody!