Jump to content

issue with FOREACH aaand FILLET if possible :)


Recommended Posts

Posted
(defun c:qwerty ( / *error* list_of_selections_1 l_o_s_1_length list_wcm number_1 entget_data_from_selection_1)
	(defun *error* (msg) (princ (strcat "\nError: " msg)))
(setq list_of_selections_1 (ssget "x" (list (cons 0 "TEXT") (cons 8 "Mootkood") (cons 7 "Standard"))))
	(setq l_o_s_1_length (sslength list_of_selections_1))
(setq number_1 (- 0 1))
	(setq number_2 (- 0 1))
(setq number_3 0)
	(setq list_wcm
		  '((" vp" "INSERT" "VILJA1" "PUU")
		   (" lp" "INSERT" "LEHTP1" "PUU")
		   (" mand" "INSERT" "MAND1" "PUU")
		   (" kkaev" "INSERT" "KAKAEV" "KKAEV")
		   (" kaev" "INSERT" "TUKAEV" "KAEV")
		   (" lm" "INSERT" "LIIKLM" "LIIKLUS")
		   (" apost" "INSERT" "VARPOS" "AED")
		   (" 1valgp" "INSERT" "VAPOST" "POST")
		   (" tqmm" "INSERT" "ANKURP" "POST")
		   (" 2valgp" "INSERT" "VAPOS2" "POST")
		   (" tugi" "INSERT" "TUPOST" "POST")
		   (" ppost" "INSERT" "PUPOST" "POST")
		   (" bpost" "INSERT" "BEPOST" "POST")
		   (" mpost" "INSERT" "MEPOST" "POST")
		   (" plpost" "INSERT" "PLPOST" "POST")
		   (" ekilp" "INSERT" "ELKAPP" "ELRAJATISMP")
		   (" sikaev" "INSERT" "SIKAEV" "SIKAEV")
		   (" gkaev" "INSERT" "GAKAEV" "GKAEV")
		   (" gsiib" "INSERT" "GAKAPE" "GKAEV")
		   (" skaev" "INSERT" "KAKAEV" "SKKAEV")
		   (" rkaev" "INSERT" "REKAEV" "SKKAEV")
		   (" vkaev" "INSERT" "VEKAEV" "VKAEV")
		   (" vsiib" "INSERT" "VESIIB" "VKAEV")
		   (" hydr" "INSERT" "THYDRM" "VKAEV")
		   (" sokaev" "INSERT" "SOKAEV" "TKAEV")
		   (" kivi" "INSERT" "KIVISU" "RELJEEF")
		   (" kivih" "INSERT" "KIVIKU" "RELJEEF")
		   (" pqq" "INSERT" "PQQSAS" "HALJASTUS")
	))
(repeat l_o_s_1_length
	(setq number_1 (1+ number_1))
(setq entget_data_from_selection_1 (entget (ssname list_of_selections_1 number_1)))
	(foreach xx list_wcm (setq a1 (car xx)) (if (wcmatch (cdr (assoc 1 entget_data_from_selection_1)) a1) (entmake (list (cons 0 (cadr xx)) (cons 2 (caddr xx)) (cons 8 (nth 3 xx)) (cons 10 (cdr (assoc 11 entget_data_from_selection_1))) (cons 41 0.5) (cons 42 0.5) (cons 43 0.5) (cons 50 0.0))))))


(setq list_wcm_wcm 
          '((" h#" "LINE" "HOONEKP" "HOONE")
		   (" hdet#" "LINE" "HOONEKP" "HOONEDET")
		   (" a#" "LINE" "ASFBET" "TEE")
		   (" b#" "LINE" "ASFBET" "TEE")
		   (" ak#" "LINE" "AAREKIVI" "TEE")
		   (" kr#" "LINE" "KRUUSKILL" "TEE")
		   (" hek#" "LINE" "HEKK" "HALJASTUS")
		   (" kolv#" "LINE" "KOLVIK" "HALJASTUS")
		   (" tm#" "LINE" "KOLVIK" "RELJEEF")
		   (" nall#" "LINE" "NOLVAALL" "RELJEEF")
		   (" npeal#" "LINE" "NOLVAPEAL" "RELJEEF")
		   (" r#" "LINE" "RAJATISP" "RAJATIS")
		   (" paed#" "LINE" "LA_AED" "AED")
		   (" maed#" "LINE" "RAKAED" "AED")
		   (" vaed#" "LINE" "VO_AED" "AED")
		   (" avund#" "LINE" "AIAVUND" "AED")
		   (" myyr#" "LINE" "MYYR" "AED")
		   (" kiviaed#" "LINE" "KIVIAED" "AED")
	))
		   


	(repeat l_o_s_1_length

(setq number_2 (1+ number_2))
	(setq number_3 (1+ number_3))

(setq entget_data_from_selection_2 (entget (ssname list_of_selections_1 number_2)))
	(setq entget_data_from_selection_3 (entget (ssname list_of_selections_1 number_3)))

(foreach xxx list_wcm_wcm (setq a2 (car xxx)) (if (and (and (wcmatch (setq obj_1 (cdr (assoc 1 entget_data_from_selection_2))) a2) (wcmatch (setq obj_2 	(cdr (assoc 1 entget_data_from_selection_3))) a2)) (= obj_1 obj_2)) (progn (entmake (list (cons 0 (cadr xxx)) (cons 6 (caddr xxx)) (cons 8 (nth 3 xxx)) (cons 10 (cdr (assoc 11 entget_data_from_selection_2))) (cons 11 (cdr (assoc 11 entget_data_from_selection_3)))))
	(setq ssget_for_join (ssget "x" (list (cons 6 (caddr xxx)) (cons 8 (nth 3 xxx)))))
(setq join_1 (apply 'command (list "pedit" "m" ssget_for_join "" "y" "j" 0 ""))))))
	;(setq fillet_1 (apply 'command (list "fillet" 
)
)

What does that code? That code takes objects from particular layer and CHECKS it with pattern (list_wcm and list_wcm_wcm)

 

I works good, but I have two issues that I would like to fix:

 

  •  I surveyed points with different names (cons 1), but I roughly follow the rule: "if I want object to be drawn as single line I should use the same survey-code, which is expressed in CAD as (cons 1 ;;code;;)  sooooo    >>>let's assume I have objects with (cons 1 "h") on my drawing<<<      So on my drawing even if objects got the same 1-DXF code😑 (like "h1") they will join only following my trace, which has been maken outside when surveyed, BUT I want it to join EVERY object that have THE same 1-dxf code, no matter where it is located in a drawing.. hope you got the idea, cuz it quite complicated to explain, sorry guys🥵
  • Second issue is that I want to fillet every object with specified LAYER (using wcmatch for that, I guess..), object - is polyline and condition is that if lines are related to each other at angle 90 degress (+/- 15 degrees) THEY WILL join with FILLET

 

I actually trying right now to accomplish the first task..
Big thanks for helping every time!!🙏

Posted
14 hours ago, ojacomarket said:

So on my drawing even if objects got the same 1-DXF code😑 (like "h1") they will join only following my trace, which has been maken outside when surveyed

 

Don't use wcmatch then.

  • Thanks 1
Posted

1st option is known as using survey code stringing its built in to any decent civil software.

 

EB01 & EB02 are two edge of road strings and the string numbers are different so they do not join all "EB" together in order of survey but rather only the corresponding EB+string number are joined.

 

A string TR is ok so is TR00 the double zero meaning its a point. in this case a Tree so for us TR03*6 is a tree with a 0.3 trunk and a 6m dia spread and we use a dynamic block for you step3.

 

Ok how to make it work rather than get spaghetti appear, is you need to do a double sort on your original point data, so you sort on codes 1st then sub sort on point number, this way your points would be EB01 EB01 EB01 EB01 EB02 EB02 EB02 EB02 and so on. The field survey is normally done in some type of pattern.

 

What about F01*F23 this is a junction of two fences so the front fence is 01 and each side fence has its own number, the guys at my ex work have like 30 + years doing this.

 

Not sure about the fillet but you can fillet all vertices of a pline in one go using standard Autocad.

 

#VERSION-1.0 NEUTRAL FILE
NOTE      TRANSLATOR: TOPGTS7 vers B.02
JOB       D:\JETTY,
UNIT      UL=M, UA=S
DATE      21/04/98,10:06:13
STN       ID=9901,HI=1.611,CO=000027
XYZ       E=1000.000,N=5000.000,H=100.000
BKB       ID=101,AZ=0.0000,HA=359.5959
SS        ID=1000,HA=127.1242,VA= 87.2356,SD=12.413,HT=1.492,CO=011418
SS        ID=1001,HA=125.0110,VA= 87.2701,SD=13.232,HT=1.492,CO=011418
SS        ID=1002,HA=126.4942,VA= 87.3533,SD=20.441,HT=1.492,CO=011418
SS        ID=1003,HA=116.3524,VA= 87.5545,SD=18.398,HT=1.492,CO=011509/BIK
SS        ID=1004,HA=108.4050,VA= 87.5812,SD=17.657,HT=1.492,CO=011509/BIK
SS        ID=1005,HA=112.0332,VA= 87.2513,SD=33.674,HT=1.492,CO=011418
SS        ID=1006,HA=106.3032,VA= 87.2131,SD=45.597,HT=1.492,CO=011418
SS        ID=1007,HA=104.4313,VA= 87.2505,SD=48.259,HT=1.492,CO=011418
SS        ID=1008,HA=104.4551,VA= 87.2450,SD=48.327,HT=1.492,CO=011903
SS        ID=1009,HA= 87.3849,VA= 87.5758,SD=47.522,HT=1.492,CO=011903
SS        ID=1010,HA= 71.4945,VA= 88.0721,SD=50.904,HT=1.492,CO=011903
SS        ID=1011,HA= 61.1527,VA= 88.2157,SD=55.784,HT=1.492,CO=011903
SS        ID=1012,HA= 58.1437,VA= 88.2857,SD=57.775,HT=1.492,CO=011903
SS        ID=1013,HA= 57.4504,VA= 88.2908,SD=58.083,HT=1.492,CO=011903
SS        ID=1014,HA= 62.0048,VA= 88.1149,SD=64.650,HT=1.492,CO=011903
SS        ID=1015,HA= 50.5948,VA= 88.5022,SD=63.934,HT=1.492,CO=001104
SS        ID=1016,HA= 41.3130,VA= 89.1916,SD=74.887,HT=1.492,CO=001104

 

Posted (edited)
On 4/18/2020 at 2:35 AM, ojacomarket said:

issue is that I want to fillet every object with specified LAYER (using wcmatch for that, I guess..), object - is polyline and condition is that if lines are related to each other at angle 90 degress (+/- 15 degrees) THEY WILL join with FILLET

 

 

recently there was discussion about bulge/fillet  http://www.theswamp.org/index.php?topic=55931.0

 

look at ripp-bulge --  Radius-InterPoint-startPoint-endPoint 

... if center is unknown, but known = radius , vertex (Intersection point) , p1 , p2  (note: vertex =/= center)
returns list (start-bulge-end)
like fillet method (can be applied trans on 3Dpoly as well)

Edited by hanhphuc
  • 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...