Author Topic: Help with Lisp Take the polyline adjacent to the boundary  (Read 719 times)

0 Members and 1 Guest are viewing this topic.

VovKa

  • Swamp Rat
  • Posts: 850
  • Ukraine
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #15 on: September 01, 2017, 05:57:08 am »
I hope they can be automated.
then it is a good time to switch to Autocad Map 3d

DEVITG

  • Bull Frog
  • Posts: 425
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #16 on: September 01, 2017, 12:55:04 pm »
Please , would you UPLOAD a true sample , just make a WBLOCK from a few samples  guess at least 10 parcel with it´s surrounding neighbor parcels .

It is hard to give a good solution if you hide your real work. 

Yours notes

Quote
I just changed the colors for easy identification of more problems. The fact that they are the same color and layer   

My problem is I work on land management. I want to export the boundary information of a parcel of land including the polyline adjacent to that boundary for documentation.

The problem was solved with Lisp (new) but I had a new problem that it only caught adjacent objects as line. For other objects it's not perfect yet
The direction of the evening's solution is:
+ Create boundary new outside of boundary old
+ Trim objects outside of bowndary new
However, with lisp (new) the objects are not deleted outside bowndary new but rather delete objects between bowndary new and bowndary old.
Help me!

I tried it and it looks like my case. It's not really effective with other objects like polyline ...



Sorry you did not understand the problem. Maybe my presentation is not correct. My main goal is from Figure A to create C. There may be many different ways. I just need 1 idea.
Foo.lisp has performed very well. But it's not perfect with objects like Polyline, Arc, Spline .... Because it's beyond the scope of my profile presentation. I need something like the image below.
Thank you very much for your help.

That's what I'm doing with my job.
After taking the polyline adjacent to the boundary. I deleted the boundary offset. and give the results as expected with test.lsp.
For a drawing there are thousands of land parcels. I still do it a craft is to extract each land one by one. And they take a lot of time to look like http://www.cadtutor.net/forum/showthread.php?101504-To-save-with-specific-portion-from-1000-same-dwgs-which-same-as- mentioned-dwg-No.
I hope they can be automated. Possible with the number of layers for example


So please star it again , show what you real have , what do you want to have with all details,

Or migrate to a better software .


We all are   eager and ready to help , but first please help yourself , an ambiguous question , return a ambiguous answer.

Be clear and complete. From start to end .

I know that English is not you native language , neither mine.  [Spanish] 
So please try to explain ti as we can get a true way to walk.

Best regards

Gabriel
devitg-alt64- gmail.com





 










Location @ Córdoba Argentina<br /><br />using acad 2008 under win XP

anhquang1989

  • Newt
  • Posts: 47
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #17 on: September 01, 2017, 01:10:06 pm »
sorry you. It's true that English is not my native language so I have difficulty presenting ideas.
And please make it clear that I do not hide my program. It is only after solving a problem that it raises a problem or a new idea to improve the program and I follow them.
The program using vietnamese language, i am afraid people do not understand the trouble again. Ok. I will upload it as soon as I can.
The last issue is that the program will automatically run all the land parcels on the drawing. (Test.dwg)
Thank you
« Last Edit: September 01, 2017, 02:21:36 pm by anhquang1989 »

Ketxu

  • Newt
  • Posts: 99
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #18 on: September 04, 2017, 10:42:42 pm »
sorry you. It's true that English is not my native language so I have difficulty presenting ideas.
And please make it clear that I do not hide my program. It is only after solving a problem that it raises a problem or a new idea to improve the program and I follow them.
The program using vietnamese language, i am afraid people do not understand the trouble again. Ok. I will upload it as soon as I can.
The last issue is that the program will automatically run all the land parcels on the drawing. (Test.dwg)
Thank you

Trên Cadviet không ai giải quyết được vấn đề của bạn à :)

anhquang1989

  • Newt
  • Posts: 47
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #19 on: September 05, 2017, 12:49:38 am »
Hi. Ketxu. Thực sự là rất lâu rồi ḿnh không sử dụng diễn đàn cadviet. C̣n vấn đề này th́ ở việt nam đă có rất nhiều chương tŕnh làm được nó. Và hiện tại theo thông tư mới nó đă không c̣n được sử dụng. Ḿnh chỉ muốn t́m hiểu sâu hơn về nó với lisp như là 1 bài học thôi nên ḿnh luôn chọn các diễn đàn nước ngoài với sự cởi mở và thoải mái hơn thôi. Cảm ơn bạn đă quan tâm. Ketxu

BIGAL

  • Newt
  • Posts: 91
  • 30 + years of using Autocad
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #20 on: September 05, 2017, 07:01:20 am »
Have a look at the cadtutor post by me. It uses the lot number to find all lots automatically. I doubt the code will be as complicated as already posted. I am busy at moment and this is a bigger task. I will try to do something.

1 Pick lot by text use Bpoly make a boundary
2 Offset boundary
3 Use copy with "F" option to pick all plines & lines
4 move it away from the original using a grid pattern for to be repeated for all lots
5 trim using a offset from the original created BPOLY pline offset again and use the "F" option with trim
6 erase the dummy plines
7 work out the centroid of the shape
8 go to layout add new using layout title block
9 mspace then zoom c scalefactor you should see your lot
10 back to pspace add the corner points in a table

here is a start ver 1
Ver 2 draws extra plines keep watching
Caution not tested properly  :mrgreen:

Code: [Select]
; pline co-ords example
; By Alan H
(defun getcoords (ent)
(vlax-safearray->list
(vlax-variant-value
(vlax-get-property
(vlax-ename->vla-object ent)
"Coordinates"
)
)
)
)
 

; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(defun co-ords2xy (co-ords / xy I )
(setq co-ordsxy '())
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)

; program starts here a test all corner points of the internal lots
(defun c:dolots2 ( / ss lay pt obj obj2 obj3 txt txtstr txtins x y co-ords2 co-ords3 co-ords4)

(setq off  (getdist "Please enter suitable offset for lines"))
(setq off2  (getdist "Please enter spacing of lots eg 2x size"))
(setq pt ( getpoint "Select a point in space for lots"))
(setq obj (vlax-ename->vla-object (car (entsel "\nPick text"))))
(setq lay (vla-get-layer obj))
(setq ss (ssget "X" (list (cons 0 "*text")(cons 8 lay))))
(repeat
(setq x (sslength ss))
(setq txt (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq txtstr (vla-get-textstring txt))
(setq txtins (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint txt))))
(setq txtins (list (- (car txtins) 0.05)(- (cadr txtins) 0.05)))
(command "bpoly" txtins "")
(setq obj2 (entlast))
(co-ords2xy (getcoords obj2))
(setq co-ords co-ordsxy)
;(setq co-ordsxy nil)
(command "offset" off obj2 (list 0 0) "")
(setq obj3 (entlast))
(co-ords2xy (getcoords obj3))
(setq co-ords2  co-ordsxy)
;(setq co-ordsxy nil)
(command "offset" off obj3 (list 0 0) "")
(setq obj4 (entlast))
(co-ords2xy (getcoords obj4))
(setq co-ords3 co-ordsxy)
;(setq co-ordsxy nil)
(command "move" obj2 obj3 obj4  "" txtins pt )
(command "zoom" "e" "zoom" "0.5XP")
(command "copy" "CP")
(while (= (getvar "cmdactive") 1 )
(foreach xy co-ords3 (command xy) )
(command "" ""  txtins pt)
)
;(command  txtins pt )
(co-ords2xy (getcoords obj4))
(setq co-ords3 co-ordsxy)
(command "erase" obj4 "")
(command "trim" obj3 "" "F")
(while (= (getvar "cmdactive") 1 )
(repeat (setq y (length co-ords3))
(command (nth (setq y (- y 1)) co-ords3))
)
(command  (nth (- (length co-ords3) 1) co-ords3))
(command  "" "")
)
(command "erase" obj2 obj3 "")
(setq pt (list (+ (car pt) off2) (cadr pt)))
)

)


« Last Edit: September 09, 2017, 03:19:11 am by BIGAL »
A man who never made a mistake never made anything

MSTG007

  • Water Moccasin
  • Posts: 2075
  • I can't remeber what I already asked! I need help!
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #21 on: September 05, 2017, 07:52:56 am »
That's Pretty Slick BIGAL.
Autodesk Infrastructure Design Suite 2017

BIGAL

  • Newt
  • Posts: 91
  • 30 + years of using Autocad
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #22 on: September 05, 2017, 06:10:40 pm »
I will try to add a bit more every day its just a time thing.
A man who never made a mistake never made anything

VovKa

  • Swamp Rat
  • Posts: 850
  • Ukraine
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #23 on: September 06, 2017, 05:13:25 am »
boundary's tracing is not 100% safe
try it on this polygon
Code: [Select]
(entmakex '((0 . "LWPOLYLINE")
    (100 . "AcDbEntity")
    (100 . "AcDbPolyline")
    (90 . 9)
    (70 . 0)
    (10 27.0534 0.603842)
    (10 53.4487 1378.68)
    (10 457.5 1378.68)
    (10 416.046 -17.2896)
    (10 495.84 104.405)
    (10 556.99 1062.45)
    (10 709.271 1062.45)
    (10 709.271 -31.8694)
    (10 27.0534 0.603842)
   )
)

BIGAL

  • Newt
  • Posts: 91
  • 30 + years of using Autocad
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #24 on: September 06, 2017, 05:18:33 am »
See code version 2 getting somewhere, needs debugging a bit more almost there see above.
« Last Edit: September 06, 2017, 06:49:47 am by BIGAL »
A man who never made a mistake never made anything

BIGAL

  • Newt
  • Posts: 91
  • 30 + years of using Autocad
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #25 on: September 09, 2017, 03:20:19 am »
See version 3 above updated very close for 1st step makes a copy of each polygon.
A man who never made a mistake never made anything

anhquang1989

  • Newt
  • Posts: 47
Re: Help with Lisp Take the polyline adjacent to the boundary
« Reply #26 on: September 10, 2017, 11:33:41 am »
 :smitten: :smitten: :smitten: