Jump to content

Connecting points by coding


djercic

Recommended Posts

Hi,

I was wondering if there was any way (lisp or program) to connect points (that are in block) by following codes. For example, I have points 1,2,3...., every point ha a code, opening code is K01 (for point 1), then K (for point 2), K (for point 3), K (for point 4)...., and closing point has code K02. I want automatically connect points with same code (K) by following rule like K01 opening of polyline, and K02 for closing polyline, between is K.

And apply this rule for any other code, (L, M, XXX, YYY...)

Example on .dwg and points in .txt is in attachment.

TEST.dxf

TEST.txt

Link to comment
Share on other sites

OK, this is with 3DPOLY, just because points are 3D... Note that block insertion point must match your desired 3D point...

 

(defun c:connectbyattriborder ( / bn ss kod broj i bl blatt tag val att atts bll bllst bllstn p pl )
 (setq bn (getstring "\nUnesite ime bloka sa podatcima koji opisuju 3D tacku (TOCKA) : "))
 (prompt "\nSelektuj tacke/blokove...")
 (setq ss (ssget (list '(0 . "INSERT") (cons 2 bn))))
 (setq kod (getstring "\nUnesite opis atributa KOD (za XXX vrednost spajam XXX1, XXX, XXX, ..., XXX2) : "))
 (setq broj (getstring "\nUnesite opis atributa BROJ (za prthodno uneti kod spajam 1,2,3,...) : "))
 (repeat (setq i (sslength ss))
   (setq bl (ssname ss (setq i (1- i))))
   (setq blatt bl)
   (while (/= (cdr (assoc 0 (entget (setq blatt (entnext blatt))))) "SEQEND")
     (if (eq (cdr (assoc 0 (entget blatt))) "ATTRIB")
       (progn
         (setq tag (cdr (assoc 2 (entget blatt))))
         (setq val (cdr (assoc 1 (entget blatt))))
         (setq att (list tag val))
         (setq atts (cons att atts))
       )
     )
   )
   (setq atts (vl-sort atts '(lambda ( a b ) (> (vl-string-search kod (cadr a)) (vl-string-search kod (cadr b))))))
   (setq atts (append (list (car atts)) (vl-sort (vl-remove (car atts) atts) '(lambda ( a b ) (> (eq broj (car a)) (eq broj (car b)))))))
   (setq bll (cons bl atts))
   (setq bllst (cons bll bllst))
   (setq atts nil)
 )
 (foreach bl bllst
   (if (or (eq kod (cadr (cadr bl))) (eq (strcat kod "01") (cadr (cadr bl))) (eq (strcat kod "02") (cadr (cadr bl))))
     (setq bllstn (cons bl bllstn))
   )
 )
 (setq bllstn (vl-sort bllstn '(lambda ( a b ) (< (atoi (cadr (caddr a))) (atoi (cadr (caddr b)))))))
 (foreach bl bllstn
   (setq p (cdr (assoc 10 (entget (car bl)))))
   (setq pl (cons p pl))
 )
 (setq pl (reverse pl))
 (command "_.3DPOLY")
 (foreach p pl
   (command "_non" p)
 )
 (command "")
 (princ)
)

HTH, M.R.

Edited by marko_ribar
code little changed - for accepting both KOD tags values "K" and "KW"
Link to comment
Share on other sites

djercic, code was updated...

 

Have rethought - if you have "K" and "KW" KOD tag values ("K" was part of "KW" string), with my revision routine should function fine now... BTW. "K01" and "K02" marks are not important as long as the same value ("K") blocks have correct BROJ tag with correct values "1", "2", ...

Edited by marko_ribar
Link to comment
Share on other sites

Marko having been involved in surveying for years I have remarked a few times about the spagetti theory ie joining "strings" this is a day to day thing for CIV3d etc. The reason I am commenting is that the method used in the sample text file is not a very good method, our surveyors have used stringing since the 80's so not new, basicly string similar lines with a common code but somehow distinguish items apart even with same id code eg 01EB, 02EB this would be two road edge of bitumen no need for start and end coding, and lines go on single layer EB, a EB or 00EB would be a point. Then we go into smart coding 03EB*s 03EB 03EB*s it will draw an arc based on these 3 points, 04EB*22LM this is line eb now having a start point on a different string altogether in this case line marking for edge of road. The second part of this is inserting blocks based on point descriptions.

 

In closing I have played a few times at doing something and closest I can think of is to sort all survey points twice 1st based on code 2nd sort based on point number for each code then do like what you have posted. I will find some sample files.

 

String example.jpg

Edited by BIGAL
Link to comment
Share on other sites

Sorry for responding so late, I was on field.

Marko thank you for a code, but i'm looking something more automatised, because I have in plan to measure aprox. 100 km of roads and infrastructure, objects near roads and I need something to connect points with same codes, more like BIGAL's example here.

Link to comment
Share on other sites

I skipped over the using CIV3D have a look at this product "Stringer" www.civilsurveysolutions.com.au does lots of things other than joining strings.

This is a instrument dump and if you look at the CO= this is the coding 308 point id 00 = point, 30889 = 308 point id string 89 626190 = 626 point id string 190, our surveyors walk strings so same point code (not actually true Leica instrument has smarts in it that let them do road cross sections and keep codes as they pick a sequence of points) The guys just start at string 01 and keep going adding 1 each time they go on a new string object, 01 L, 02 CL 03 R, they do have a limit of 999 never been a problem.

 

SS        ID=1039, HA=145.4458, VA=90.2351, SD=32.972, HT=1.527, CO=308000 
SS        ID=1040, HA=146.3534, VA=90.1318, SD=33.725, HT=1.527, CO=310000 
SS        ID=1041, HA=165.5847, VA=90.0843, SD=38.092, HT=1.527, CO=308000 
SS        ID=1042, HA=178.5723, VA=90.0755, SD=37.205, HT=1.527, CO=308000 
SS        ID=1043, HA=180.5404, VA=90.0002, SD=35.383, HT=1.527, CO=310000 
SS        ID=1044, HA=183.1014, VA=90.2335, SD=30.423, HT=1.527, CO=PLUG000 
SS        ID=1045, HA=196.5235, VA=90.1832, SD=29.785, HT=1.527, CO=310000 
SS        ID=1046, HA=197.2032, VA=90.2714, SD=28.790, HT=1.527, CO=308000 
SS        ID=1047, HA=202.2400, VA=90.5045, SD=21.041, HT=1.527, CO=308089 
SS        ID=1048, HA=203.0942, VA=90.3956, SD=20.367, HT=1.527, CO=308089 
SS        ID=1049, HA=206.2914, VA=90.3803, SD=20.928, HT=1.527, CO=308089 
SS        ID=1050, HA=205.3751, VA=90.5208, SD=21.611, HT=1.527, CO=308089 
SS        ID=1051, HA=181.4741, VA=90.2950, SD=14.414, HT=1.527, CO=503000 
SS        ID=1052, HA=211.1759, VA=90.2506, SD=13.705, HT=1.527, CO=713000 
SS        ID=1053, HA=137.1904, VA=90.1409, SD=21.707, HT=1.527, CO=NAIL000 
SS        ID=1054, HA=123.3404, VA=90.0347, SD=28.530, HT=1.527, CO=626190 
SS        ID=1055, HA=131.5848, VA=90.0456, SD=23.592, HT=1.527, CO=626190 
SS        ID=1056, HA=136.3813, VA=90.1608, SD=21.640, HT=1.527, CO=626190 
SS        ID=1057, HA=136.2451, VA=90.1456, SD=19.895, HT=1.527, CO=626190 
SS        ID=1058, HA=135.4628, VA=90.0808, SD=17.944, HT=1.527, CO=626190 
SS        ID=1059, HA=117.4901, VA=90.0537, SD=14.068, HT=1.527, CO=626190 
SS        ID=1060, HA=88.1957, VA=90.1204, SD=12.463, HT=1.527, CO=626190 
SS        ID=1061, HA=89.0946, VA=90.1521, SD=14.736, HT=1.527, CO=626190 
SS        ID=1062, HA=90.0938, VA=90.1318, SD=17.603, HT=1.527, CO=626190 
SS        ID=1063, HA=96.0436, VA=90.1239, SD=19.824, HT=1.527, CO=626190 
SS        ID=1064, HA=91.2518, VA=90.0610, SD=20.198, HT=1.527, CO=903102 
SS        ID=1065, HA=89.1502, VA=90.0558, SD=19.355, HT=1.527, CO=903102 
SS        ID=1066, HA=74.4146, VA=90.0652, SD=16.340, HT=1.527, CO=903102 
SS        ID=1067, HA=69.5743, VA=90.0719, SD=15.962, HT=1.527, CO=903102 
SS        ID=1068, HA=61.0934, VA=90.1022, SD=15.898, HT=1.527, CO=903102 
SS        ID=1069, HA=54.5358, VA=90.0828, SD=16.275, HT=1.527, CO=903102 
SS        ID=1070, HA=48.2317, VA=90.0938, SD=17.127, HT=1.527, CO=903102 
SS        ID=1071, HA=43.4240, VA=90.1619, SD=18.110, HT=1.527, CO=903102 
SS        ID=1072, HA=39.4505, VA=90.0414, SD=19.311, HT=1.527, CO=903102 
SS        ID=1073, HA=34.0308, VA=90.0803, SD=21.975, HT=1.527, CO=903102 
SS        ID=1074, HA=41.2226, VA=90.0958, SD=18.644, HT=1.527, CO=626189 
SS        ID=1075, HA=59.3526, VA=90.0450, SD=14.294, HT=1.527, CO=626189 
SS        ID=1076, HA=63.4030, VA=90.1147, SD=14.307, HT=1.527, CO=626189 
SS        ID=1077, HA=70.3118, VA=90.1645, SD=14.433, HT=1.527, CO=626189 
SS        ID=1078, HA=74.4521, VA=90.1956, SD=14.732, HT=1.527, CO=626189 
SS        ID=1079, HA=77.1217, VA=90.2100, SD=14.937, HT=1.527, CO=626189 

Link to comment
Share on other sites

Survey-1.zipHere is a sample field book file as supplied in the examples for CIV3D look at the coding and you will see B for begin. The stringing method used here in AUS using numbers just implies a begin. Even in the sample field book you can see the string numbers being used but you have to add a begin also a doubling up.
Link to comment
Share on other sites

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...