TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TJAM51 on December 03, 2004, 07:35:01 AM
-
I am seeking a routine that will join a pline and offer a crossing or pick without having to go throuh all the PEDIT process....thanks
-
If you have express tools use pljoin
-
I have this but never tried it.
;; from Marc'Antonio Alessi (nospam_maalessi_at_tin_dot_it)
; #PlineJoinPrec = global
;
(defun C:ALE_PlJoin (/ SelSet FltLst OldLPr)
;(setvar "CMDECHO" 0) ; I have always = 0
(princ "\nSelect lines, arcs or polylines to join: ")
(setq OldLPr (getvar "LUPREC")) (setvar "LUPREC" 8)
(setq
FltLst
'((0 . "LWPOLYLINE,POLYLINE,LINE,ARC"))
#PlineJoinPrec
(ureal 5 "" "Precision distance" (cond ( #PlineJoinPrec ) ( 0.00001 )))
)
(setvar "LUPREC" OldLPr)
(cond
( (not (setq SelSet (cond ((ssget "_I" FltLst)) ((ssget FltLst)))))
(prompt "\nNo arc or polyline selected. ")
)
( (ssget "_P" '((0 . "LINE,ARC")))
(command "_.PEDIT" "_M" SelSet "" "_Y" "_J" "_J" "_E" #PlineJoinPrec"")
(princ (strcat
"\n" (itoa (sslength SelSet))
" lines, arcs or polylines are joined. "
) )
)
( T
(command "_.PEDIT" "_M" SelSet "" "_J" "_J" "_E" #PlineJoinPrec "")
(princ "\n_ ")
(princ (strcat "\n " (itoa (sslength SelSet)) " polylines are joined."))
)
)
(princ)
)
;*
;* UREAL Funzione di interfaccia utente per numeri reali.
;* BIT (0 per nessuno) e KWD key word ("" per nessuna) sono gli stessi di
;* INITGET.
;* MSG e' la stringa di prompt, alla quale e' aggiunto numero reale di default
;* come <DEF> (nil per nessuno), e un : sara' aggiunto.
;*
(defun ureal (bit kwd msg def / inp)
(if def
(setq
msg (strcat "\n" msg " <" (ALE_RTOS_DZ8 def) ">: ")
bit (* 2 (fix (/ bit 2)))
)
(setq msg (strcat "\n" msg ": "))
)
(initget bit kwd)
(setq inp (getreal msg))
(if inp inp def)
);defun UREAL
;
(defun ALE_RtoS_DZ8 (ReaVal / CurDZn OutVal)
(if (= 8 (setq CurDZn (getvar "DIMZIN")))
(setq CurDZn nil)
(setvar "DIMZIN" 8)
)
(setq OutVal (rtos ReaVal 2))
(and CurDZn (setvar "DIMZIN" CurDZn))
OutVal
)
-
HOW CAN THIS ROUTINE BE REWRITTEN SO THAT IT IS NOT NECESSARY TO ENTER FUZZ DISTANCE AT THE COMMAND LINE EACH TIME, BUT THE OPTION COULD BE AVAILABLE?
-
If you have a few dollars and don't want to write you own .... GBPoly [ http://www.geometricad.com/ ] You'll find it hard to beat. :-)
-
Here's the one I use...
;;
;; 06/22/05
;; Polyline Joins Selected Objects
;;
(defun c:j (/ ss)
(prompt "\nSelect Objects to Join... ")
(setq ss (ssget))
(command "pedit" "m" ss "" "j" "" "")
(princ)
)
-
If you have a few dollars and don't want to write you own .... GBPoly [ http://www.geometricad.com/ ] You'll find it hard to beat. :-)
Very good app.
-
Yes....
Here is a link to see GBPOLY in action:
http://www.geometricad.com/app.php?id=1&lang=en
There are a lot of open source, samples on how to join plines, lines and arcs, if you are looking for a smart and easy way to generate closed areas, then give GBPOLY a try.
-
Ahhh...that makes me happy :lmao:
Thanks. One of these days, I need to starting writing lisp.
-
How about sooner that later.
Lisp Forum (http://www.theswamp.org/forum/index.php?board=26.0)
Lisp Course Documents (http://www.theswamp.org/forum/index.php?topic=7036.0)
-
How about sooner that later.
Lisp Forum (http://www.theswamp.org/forum/index.php?board=26.0)
Lisp Course Documents (http://www.theswamp.org/forum/index.php?topic=7036.0)
An Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you
-
How about sooner that later.
Lisp Forum (http://www.theswamp.org/forum/index.php?board=26.0)
Lisp Course Documents (http://www.theswamp.org/forum/index.php?topic=7036.0)
An Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you
Ditto.
-
I think that was invitation only forum. You had to sign up for the class.
Maybe Mark can unlock that for everyone?
edit
Sorry 'bout that guys I forgot.
-
I get the same thing .... perhaps when Mark was playing around with the board he got it mal-adjusted ...
-
That was a course that was run by Stig. We had to sign up for the course. I believe its only for the students on Stigs course.
T :-)
-
However I just remembered about This (http://klobouk.fsv.cvut.cz/~chour/Lisp/Contents.htm)
I havent tried it myself yet, so I'm not sure about its content.
Happy reading.
T :-)
-
I just got both links but I was signed up. :-)
Or perhaps Mark changed something.
-
I am seeking a routine that will join a pline and offer a crossing or pick without having to go throuh all the PEDIT process....thanks
some info is missing here...
if you have 2 PLINEs or LINEs...
but in diffrent color and/or linetype....
How can you detect wich you need to joint ??
eg: you have a RED pline and a BLUE LINE...
you need to joint both..
but, need to take the BLUE layer...or color...or linetype...
if after making...you result was RED in wrong layer...
you do not have saved much time... and even worse.
isn't it ?
so that why i think crossing option is not good idea. :kewl:
-
The one you pick first should be the dominent line. If you pick blue then red then the new line will be blue.
-
Ok, I have wrote this..few year ago..
maybe the syntax is not perfect..but you can verify and modify as your own..
;;By Andrea Andreeti ;;
(defun c:joncline ()
(ljgvar2nil)
(setq ljg1_sel1 (entsel "Select line 1... "))
(if (= ljg1_sel1 nil)(exit)
(progn
(setq ljg1_sel2 (entget (car ljg1_sel1)))
(setq ljg_ent (cdr (assoc 0 ljg1_sel2)));;type d'entité
(if (/= ljg_ent "LINE")(ljg_expline1))
))
(setq ljg1_pt1 (cdr (assoc 11 ljg1_sel2)))
(setq ljg1_pt2 (cdr (assoc 10 ljg1_sel2)))
(setq ljg2_sel1 (entsel "Select line 2... "))
(if (= ljg2_sel1 nil)(exit)
(progn
(setq ljg2_sel2 (entget (car ljg2_sel1)))
(setq ljg_ent (cdr (assoc 0 ljg2_sel2)));;type d'entité
(if (/= ljg_ent "LINE")(ljg_expline2))
))
(setq ljg2_pt1 (cdr (assoc 11 ljg2_sel2)))
(setq ljg2_pt2 (cdr (assoc 10 ljg2_sel2)))
(setq dist_f1 (distance ljg1_pt1 ljg2_pt1))
(setq dist_f2 (distance ljg1_pt2 ljg2_pt1))
(if (> dist_f1 dist_f2)(setq spoint ljg1_pt2)(setq spoint ljg1_pt1))
(setq dist_f3 (distance spoint ljg2_pt2))
(setq dist_f4 (distance spoint ljg2_pt1))
(if (< dist_f3 dist_f4)(setq epoint ljg2_pt1)(setq epoint ljg2_pt2))
(if (= spoint ljg1_pt2)(setq pvar 10)(setq pvar 11))
(vl-cmdf "_erase" ljg2_sel1 "")
(setq ljg1_sel2
(subst (cons pvar epoint)
(assoc 11 ljg1_sel2)
ljg1_sel2
))
(entmod ljg1_sel2)
(princ)
(ljgvar2nil)
)
;; ;;
;; Capture du type d'entité ;;
;; ;;
(defun ljg_type ()
(if (or(/= ljg_ent "LINE")(/= ljg_ent "LWPOLYLINE"))
(alert (strcat "You have selected a " ljg_ent)))
(setq ljg_ent nil)
)
;; ;;
;; PLINE1 CHECK ;;
;; ;;
(defun ljg_expline1()
(if (= ljg_ent "LWPOLYLINE")
(progn
(vl-cmdf "_explode" ljg1_sel1 "")
(setq ljg1_sel1 (entlast))
(setq ljg1_sel2 (entget ljg1_sel1))
)
(ljg_type))
)
;; ;;
;; PLINE2 CHECK ;;
;; ;;
(defun ljg_expline2()
(if (= ljg_ent "LWPOLYLINE")
(progn
(vl-cmdf "_explode" ljg2_sel1 "")
(setq ljg2_sel1 (entlast))
(setq ljg2_sel2 (entget ljg2_sel1))
)
(ljg_type))
)
;; ;;
;; remet les variables ŕ NIL ;;
;; ;;
(defun ljgvar2nil()
(setq w nil)
(setq ljg_ent nil
ljg1_sel1 nil
ljg1_sel2 nil
ljg1_pt1 nil
ljg1_pt2 nil
ljg2_pt1 nil
ljg2_pt2 nil
dist_f1 nil
dist_f2 nil
dist_f3 nil
dist_f4 nil
spoint nil
epoint nil
pvar nil)
)