Aller au contenu

Messages recommandés

Posté(e)

Attention il est sous LT donc pas de Lisp. C'est pas gagner.

 

@+

MDSV31

 

Ps: si quelqu'un a une solution je suis preneur.

Dessinateur Indépendant

Posté(e)

bonjour,

 

encore quelqu'un qui n'a pas tout à fait compris la différence

de prix entre AutoCad LT et AutoCad Complet.

 

soit tu veux faire un talus ponctuellement :

dans ce cas, utilise les commandes diviser, mesurer...

c'est empirique mais ça fonctionne

 

soit c'est dans le cadre de ton métier :

tu vas dans le bureau du taulier et tu lui expliques

qu'avec une pince à épiler on ne fait pas de terrassement.

 

amicalement

  • 4 mois après...
Posté(e)

bonjour l'ami

voici la solution pour ton probleme j'ai un lisp qui génère des talus sous AutoCAD

voici le lisp talus.lsp

 

(defun talerr (ch / )

(cond

((eq ch "Function cancelled") nil)

((eq ch "quit / exit abort") nil)

((eq ch "console break") nil)

(T (princ ch))

)

(setq *error* olderr)

(command "_.undo" "_end")

(command "_.u")

(if (<= sv_und 3) (command "_.undo" "_control" "_one"))

(setvar "cmdecho" 1)

(princ)

)

(defun tststr (chaine / chaine)

(if (wcmatch chaine "*[`?`,```*\\\"<>/=|:]*")

(progn

(set_tile "error" "Nom de plan incorrect !")

(set_tile "pl_tal" pl_tal)

)

(progn

(setq pl_tal chaine)

(set_tile "error" "")

)

)

)

(defun tstval (val idx_v / val idx_v)

(if (distof val)

(progn

(if idx_v

(setq g_barb (distof val))

(setq e_barb (distof val))

)

(set_tile "error" "")

)

(progn

(set_tile "error" "Valeur numérique incorrecte !")

(if idx_v

(set_tile "g_barb" (rtos g_barb))

(set_tile "e_barb" (rtos e_barb))

)

)

)

)

(defun getindex (item itemlist / m n)

(setq n (length itemlist))

(if (> (setq m (length (member item itemlist))) 0)

(- n m)

nil

)

)

(defun colorname (colnum)

(setq cn (abs colnum))

(cond

((= cn 1) "rouge")

((= cn 2) "jaune")

((= cn 3) "vert")

((= cn 4) "cyan")

((= cn 5) "bleu")

((= cn 6) "magenta")

((= cn 7) "blanc")

(T (itoa cn))

)

)

(defun makelaylists (/ layname onoff frozth color linetype vpf vpn ss cvpname

xdlist vpldata sortlist name templist bit-70

)

(if (= (setq tilemode (getvar "tilemode")) 0)

(progn

(setq ss

(ssget "_x"

(list (cons 0 "VIEWPORT")

(cons 69 (getvar "CVPORT"))

)

)

)

(setq cvpname (ssname ss 0))

(setq xdlist (assoc -3 (entget cvpname '("acad"))))

(setq vpldata (cdadr xdlist))

)

)

(setq sortlist nil)

(setq templist (tblnext "LAYER" T))

(while templist

(setq name (cdr (assoc 2 templist)))

(setq sortlist (cons name sortlist))

(setq templist (tblnext "LAYER"))

)

(if (>= (getvar "maxsort") (length sortlist))

(setq sortlist (acad_strlsort sortlist))

(setq sortlist (reverse sortlist))

)

(setq laynmlst sortlist)

(setq longlist nil)

(setq layname (car sortlist))

(while layname

(setq laylist (tblsearch "LAYER" layname))

(setq color (cdr (assoc 62 laylist)))

(if (minusp color)

(setq onoff ".")

(setq onoff "AC")

)

(setq color (abs color))

(setq colname (colorname color))

(setq bit-70 (cdr (assoc 70 laylist)))

(if (= (logand bit-70 1) 1)

(setq frozth "F" fchk laylist)

(setq frozth ".")

)

(if (= (logand bit-70 2) 2)

(setq vpn "N")

(setq vpn ".")

)

(if (= (logand bit-70 4) 4)

(setq lock "L")

(setq lock ".")

)

(setq linetype (cdr (assoc 6 laylist)))

(setq layname (substr layname 1 31))

(if (= tilemode 0)

(progn

(if (member (cons 1003 layname) vpldata)

(setq vpf "C")

(setq vpf ".")

)

)

(setq vpf ".")

)

(setq ltabstr (strcat layname "\t" onoff "\t" frozth "\t" lock "\t" vpf "\t" vpn "\t" colname "\t" linetype))

(setq longlist (append longlist (list ltabstr)))

(setq sortlist (cdr sortlist))

(setq layname (car sortlist))

)

)

(defun getlayer (/ old-idx layname on off frozth linetype colname)

(if (not (new_dialog "setlayer" dcl_id)) (exit))

(makelaylists)

(if (= lay-idx ())

(setq lay-idx (getindex (getvar "clayer") laynmlst))

)

(start_list "list_lay")

(mapcar 'add_list longlist)

(end_list)

(setq old-idx lay-idx)

(if (/= lay-idx nil) (laylist_act (itoa lay-idx)))

(set_tile "cur_layer" (getvar "clayer"))

(action_tile "list_lay" "(laylist_act $value)")

(action_tile "edit_lay" "(layedit_act $value)")

(action_tile "accept" "(test-ok)")

(action_tile "cancel" "(reset-lay)")

(if (= (start_dialog) 1)

(progn

(if (= lay-idx nil) (setq layname "Divers"))

(set_tile "t_layer" layname)

(if (= lt-idx 0)

(set_tile "t_ltype" (bylayer_lt))

)

(if (= ecolor 256)

(progn

(set_tile "t_color" (bylayer_col))

(col_tile "show_image" cn nil)

)

)

layname

)

elayer

)

)

(defun test-ok ( / errtile)

(setq errtile (get_tile "error"))

(cond

( (= errtile "")

(done_dialog 1)

(set_tile "pl_tal" layname)

)

)

)

(defun reset-lay ()

(setq lay-idx old-idx)

(done_dialog 0)

(set_tile "pl_tal" pl_tal)

(setq elayer pl_tal)

)

(defun laylist_act (index / layinfo color dashdata)

(set_tile "error" "")

(setq lay-idx (atoi index))

(setq layname (nth lay-idx laynmlst))

(setq layinfo (tblsearch "layer" layname))

(setq color (cdr (assoc 62 layinfo)))

(setq color (abs color))

(setq colname (colorname color))

(set_tile "list_lay" (itoa lay-idx))

(set_tile "edit_lay" layname)

(mode_tile "list_lay" 2)

)

(defun layedit_act (layvalue)

(setq layvalue (strcase layvalue))

(if (setq lay-idx (getindex layvalue laynmlst))

(progn

(set_tile "error" "")

(laylist_act (itoa lay-idx))

)

(progn

(set_tile "error" "Nom de Plan Incorrect.")

(setq lay-idx old-idx)

)

)

)

(defun tlcplx (drp / )

(mode_tile t_mode 4)

(setq t_mode $key)

(mode_tile t_mode 4)

(if (= t_mode "mod_tal")

(progn

(set_tile "cmplx" "0")

(setq t_cplx "0")

(mode_tile "cmplx" 1)

)

(progn

(set_tile "cmplx" drp)

(mode_tile "cmplx" 0)

)

)

)

(defun c:talus ( / sv_blp sv_osm sv_pdm sv_sor sv_ucs sv_und ajus_t t_mode pl_tal t_cplx p_barb g_barb e_barb em_brb gm_brb pm_brb last_e nam_pl l_ptcr nb_rep l_ptdc l_ptds ent_cr typ_en dcl_id what_next tal_lst pt_pd ent_pd n_i key v1 v2 det_or ang_sp js_ok js_pd cod nom nb_barb lg_seg pt p_prec pt_tst count)

(setvar "cmdecho" 0)

(if (<= (setq sv_und (getvar "undoctl")) 3) (command "_.undo" "_control" "_all"))

(command "_.undo" "_group")

(setq olderr *error* *error* talerr)

(setq last_e (entlast))

(setq sv_blp (getvar "blipmode"))

(setvar "blipmode" 0)

(setq sv_osm (getvar "osmode"))

(setvar "osmode" 0)

(setq sv_pdm (getvar "pdmode"))

(if (/= sv_pdm 0) (setvar "pdmode" 0))

(setq sv_sor (getvar "sortents"))

(setvar "sortents" 3)

(setq sv_ucs (getvar "worlducs"))

(if (= sv_ucs 0) (command "_.ucs" ""))

(setq nam_pl (getvar "clayer"))

(if (/= (substr (getvar "users2") 1 7) "mod_tal")

(progn

(setvar "userr1" 1.5)

(setvar "userr2" 4.5)

(setvar "userr3" 1.0)

(setvar "users1" "1")

(setvar "users2" "mod_tal3")

(setvar "users3" "TALUS")

(setvar "users4" "0")

)

)

(setq pm_brb (getvar "userr1")

gm_brb (getvar "userr2")

em_brb (getvar "userr3")

ajus_t (getvar "users1")

t_mode (getvar "users2")

pl_tal (getvar "users3")

t_cplx (getvar "users4")

)

(setq p_barb pm_brb g_barb gm_brb e_barb em_brb l_ptcr () nb_rep 0 l_ptdc () l_ptds ())

(while (null (setq ent_cr (entsel "\nCliquer la crête de talus !"))))

(setq typ_en (cdr (assoc 0 (entget (car ent_cr)))))

(cond

((or

(= typ_en "LINE")

(= typ_en "ARC")

(= typ_en "SPLINE")

(= typ_en "CIRCLE")

(= typ_en "ELLIPSE")

(= typ_en "LWPOLYLINE")

(= typ_en "POLYLINE")

)

(setq dcl_id (load_dialog "talus"))

(setq what_next 3)

(while (< 1 what_next)

(if (not (new_dialog "talus" dcl_id)) (exit))

(set_tile "cmplx" t_cplx)

(set_tile "pl_tal" pl_tal)

(set_tile "g_barb" (rtos g_barb))

(set_tile "e_barb" (rtos e_barb))

(set_tile "ajust" ajus_t)

(set_tile "error" "")

(setq tal_lst '("tal0" "tal1" "tal2" "tal3" "tal4" "tal"))

(foreach img tal_lst

(start_image (strcat "mod_" img))

(slide_image

0 0

(- (dimx_tile (strcat "mod_" img)) 1) (- (dimy_tile (strcat "mod_" img)) 1)

(strcat "talus(" img ")")

)

(end_image)

)

(mode_tile t_mode 2)

(mode_tile t_mode 4)

(if (= t_mode "mod_tal")

(progn

(setq t_cplx "0")

(mode_tile "cmplx" 1)

)

(progn

(mode_tile "cmplx" 0)

)

)

(foreach img tal_lst

(action_tile (strcat "mod_" img) "(tlcplx t_cplx)")

)

(action_tile "pl_tal" "(tststr $value)")

(action_tile "pl_name" "(setq pl_tal (getlayer))")

(action_tile "g_barb" "(tstval $value T)")

(setq p_barb (/ g_barb 3))

(action_tile "pick_g" "(done_dialog 2)")

(action_tile "e_barb" "(tstval $value nil)")

(action_tile "pick_e" "(done_dialog 3)")

(action_tile "ajust" "(setq ajus_t $value)")

(action_tile "cmplx" "(setq t_cplx $value)")

(action_tile "accept" "(done_dialog 1)")

(action_tile "cancel" "(done_dialog 0)")

(setq what_next (start_dialog))

(cond

((= what_next 2)

(initget 91)

(setq g_barb (getdist (cadr ent_cr) "\nLongueur des barbes les plus longues: "))

)

((= what_next 3)

(initget 91)

(setq e_barb (getdist (cadr ent_cr) "\nEspacement des barbes: "))

)

)

)

(unload_dialog dcl_id)

(cond

((not (zerop what_next))

 

(command "_.measure" (car ent_cr) e_barb)

(while

(and

(= (cdr (assoc 0 (entget (entlast)))) "POINT")

(not (equal (entlast) last_e))

)

(setq l_ptcr (cons (cdr (assoc 10 (entget (entlast)))) l_ptcr))

(entdel (entlast))

)

(cond

((and l_ptcr (> (length l_ptcr) 1))

(setq ent_pd nil typ_en nil)

(princ "\nCliquer le pied de talus !")

(while (or (null ent_pd) (not (member typ_en '("LINE" "ARC" "SPLINE" "CIRCLE" "ELLIPSE" "LWPOLYLINE" "VERTEX"))))

(setq n_i 0)

(while (/= (car (setq key (grread T 4 2))) 3)

(cond

((/= (car key) 25)

(grdraw (car l_ptcr) (cadr key) -1)

(if (zerop n_i) (grdraw (car l_ptcr) (cadr key) -1))

(setq n_i 1)

)

(T (setq n_i 0))

)

)

(setq ent_pd (nentselp (cadr key)))

(cond

((car ent_pd)

(setq ent_pd (entget (car ent_pd)) typ_en (cdr (assoc 0 ent_pd)))

(if (not (member typ_en '("LINE" "ARC" "SPLINE" "CIRCLE" "ELLIPSE" "LWPOLYLINE" "VERTEX")))

(princ "\nLe pied de talus n'est pas une polyligne, spline, ligne, arc, cercle ou ellipse! ")

)

)

)

)

(if (eq typ_en "VERTEX")

(redraw (cdr (assoc 330 ent_pd)) 3)

(redraw (cdar ent_pd) 3)

)

(setq

v1 (mapcar '- (cadr l_ptcr) (car l_ptcr))

v2 (mapcar '- (cadr key) (car l_ptcr))

det_or (apply '(lambda (x1 y1 z1 x2 y2 z2) (- (* x1 y2) (* y1 x2))) (append v1 v2))

)

(cond

((> det_or 0.0) (setq ang_sp (/ pi 2)))

((< det_or 0.0) (setq ang_sp (- (/ pi 2))))

(T (setq ang_sp nil l_ptcr ()) (prompt "\nImpossible d'orienter les barbes de talus") (exit))

)

(setq js_pd (ssadd))

(prompt "\nChoix de seuils supplémentaires : ")

(setq js_pd

(ssget

'(

(-4 . "

(-4 . "")

(-4 . "")

(-4 . "")

(-4 . "")

(-4 . "")

(-4 . "")

(-4 . "")

(-4 . "OR>")

)

)

)

(if (null js_pd) (setq js_pd (ssadd)))

(ssadd (cdar ent_pd) js_pd)

(if (eq typ_en "VERTEX")

(redraw (cdr (assoc 330 ent_pd)) 4)

(redraw (cdar ent_pd) 4)

)

(setq l_ptdc ())

(if (zerop (sslength js_pd)) (setq ajus_t "0"))

(if (= (setq cod (tblsearch "layer" pl_tal)) ())

(command "_.layer" "_new" pl_tal "_color" 15 pl_tal "_set" pl_tal "")

(progn

(setq nom (cdr (assoc 2 cod)))

(cond

((= (boole 1 7 (cdr (assoc 70 cod))) 1)

(command "._layer" "_thaw" nom "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 2)

(command "._vplayer" "_thaw" nom "" "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 3)

(command "._layer" "_thaw" nom "")

(command "._vplayer" "_thaw" nom "" "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 4)

(command "._layer" "_unlock" nom "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 5)

(command "._layer" "_unlock" nom "_thaw" nom "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 6)

(command "._layer" "_unlock" nom "")

(command "._vplayer" "_thaw" nom "" "")

)

((= (boole 1 7 (cdr (assoc 70 cod))) 7)

(command "._vplayer" "_thaw" nom "" "")

(command "._layer" "_unlock" nom "_thaw" nom "")

)

)

(setvar "CLAYER" pl_tal)

)

)

(setq p_barb (/ g_barb 3))

(setvar "userr1" p_barb)

(setvar "userr2" g_barb)

(setvar "userr3" e_barb)

(setvar "users1" ajus_t)

(setvar "users2" t_mode)

(setvar "users3" pl_tal)

(setvar "users4" t_cplx)

(cond

((or (eq t_mode "mod_tal0") (eq t_mode "mod_tal")) (setq nb_barb 0))

((eq t_mode "mod_tal1") (setq nb_barb 2))

((eq t_mode "mod_tal2") (setq nb_barb 3))

((eq t_mode "mod_tal3") (setq nb_barb 4))

((eq t_mode "mod_tal4") (setq nb_barb 5))

)

(while (cadr l_ptcr)

(cond

((zerop nb_barb) (setq lg_seg g_barb))

(T

(if (zerop (rem nb_rep nb_barb))

(setq lg_seg g_barb)

(setq lg_seg p_barb)

)

)

)

(cond

((zerop nb_rep)

(setq pt (polar (car l_ptcr) (+ (angle (car l_ptcr) (cadr l_ptcr)) ang_sp) lg_seg) p_prec (car l_ptcr))

)

(T

(setq pt (polar (car l_ptcr) (+ (angle p_prec (cadr l_ptcr)) ang_sp) lg_seg) p_prec (car l_ptcr))

)

)

(if (eq t_mode "mod_tal")

(command "_.pline" (car l_ptcr) "_width" (/ e_barb 2) "0.0" pt "")

(command "_.line" (car l_ptcr) pt "")

)

(if (eq ajus_t "1")

(progn

(setvar "OSMODE" 1)

(setq pt_tst (cdr (assoc 11 (entget (entlast)))))

(command "_.trim" js_pd "" (list (entlast) pt) "")

(if (not (equal (cdr (assoc 11 (entget (entlast)))) pt_tst))

(setq pt T)

)

(setvar "OSMODE" 0)

)

)

(if (= t_cplx "1")

(if (eq lg_seg g_barb)

(setq l_ptdc (cons pt l_ptdc))

)

)

(setq l_ptcr (cdr l_ptcr) nb_rep (1+ nb_rep))

(cond

((and (eq (length l_ptcr) 1) (not (equal (car l_ptcr) p_prec)))

(setq l_ptcr (cons (car l_ptcr) l_ptcr))

)

((and (eq (length l_ptcr) 1) (equal (car l_ptcr) p_prec))

(while (> (length l_ptdc) 1)

(cond

((and (listp (car l_ptdc)) (listp (cadr l_ptdc)))

(setq l_ptds

(cons

((lambda (l)

(list

(/ (+ (caar l) (caadr l)) 2.0)

(/ (+ (cadar l) (cadadr l)) 2.0)

(/ (+ (caddar l) (caddr (cadr l))) 2.0)

)

)

(list (car l_ptdc) (cadr l_ptdc))

)

l_ptds

)

)

)

)

(setq l_ptdc (cdr l_ptdc))

)

(setq l_ptcr () count 0)

(mapcar '(lambda (x) (setq count (1+ count))(if (zerop (rem count 2)) (setq l_ptcr (cons x l_ptcr)))) l_ptds)

(setq nb_barb 0 nb_rep 0 l_ptds () ang_sp (- ang_sp))

)

)

)

)

(T (prompt "\nEspacement des barbes trop important pour l'élément sélectionné. "))

)

 

)

(T (prompt "\n*Arrêt*") talerr)

)

)

(T (prompt "\nLa crête de talus n'est pas une polyligne, spline, ligne, arc, cercle ou ellipse! "))

)

(setvar "blipmode" sv_blp)

(setvar "osmode" sv_osm)

(setvar "sortents" sv_sor)

(setvar "clayer" nam_pl)

(if (/= sv_pdm 0) (setvar "pdmode" sv_pdm))

(if (= sv_ucs 0) (command "_.ucs" "_p"))

(setq *error* olderr)

(command "_.undo" "_end")

(if (<= sv_und 3) (command "_.undo" "_control" "_one"))

(setvar "cmdecho" 1)

(prin1)

)

 

 

 

 

voici sont dcl talus.dcl

 

 

talus : dialog {

label = "Définition des Talus";

: boxed_row {

label = "Choix du Type de Talus";

: image_button {

key = "mod_tal0";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

: image_button {

key = "mod_tal1";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

: image_button {

key = "mod_tal2";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

: image_button {

key = "mod_tal3";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

: image_button {

key = "mod_tal4";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

: image_button {

key = "mod_tal";

width = 5;

fixed_width = true;

aspect_ratio = 1.0;

color = 0;

}

}

:boxed_column {

label = "Choix du Calque de Conception des Talus";

:edit_box {

label = "Calque:";

mnemonic = "C";

key = "pl_tal";

width = 32;

edit_width = 32;

edit_limit = 31;

}

: button {

label = "Choix dans Liste des calques...";

mnemonic = "L";

key = "pl_name";

fixed_width = true;

alignment = centered;

}

}

:column {

label = "Dimensionnement des barbes";

alignment = left;

: row {

: edit_box {

label = "Barbes-Longueur :";

mnemonic = "L";

key = "g_barb";

edit_width = 10;

}

: button {

label = "Saisir <";

mnemonic = "S";

key = "pick_g";

}

}

: row {

: edit_box {

label = "Barbes-Espacement:";

mnemonic = "E";

key = "e_barb";

edit_width = 10;

}

: button {

label = "Saisir <";

mnemonic = "S";

key = "pick_e";

}

}

: row {

: toggle {

label = "Ajustement des Barbes";

mnemonic = "A";

key = "ajust";

}

: toggle {

label = "Talus complexe";

mnemonic = "T";

key = "cmplx";

}

}

}

ok_cancel_err;

}

setlayer : dialog {

subassembly = 0;

label = "Choix du Calque";

initial_focus = "listbox";

: concatenation {

children_fixed_width = true;

key = "clayer";

: text_part {

label = "Calque Courant: ";

}

: text_part {

key = "cur_layer";

width = 35;

}

}

: row {

fixed_width = true;

key = "titles";

children_fixed_width = true;

: text {

label = "Nom du Calque";

width = 34;

}

: text {

label = "Etat";

width = 9;

}

: text {

label = "Couleur";

width = 8;

}

: text {

label = "Type de ligne";

width = 12;

}

}

: list_box {

tabs = "32 35 37 39 41 44 53";

width = 67;

height = 12;

key = "list_lay";

allow_accept = true;

}

: row {

key = "controls";

: column {

key = "lname";

fixed_width = true;

: edit_box {

label = "Définir le Nom du Calque:";

mnemonic = "D";

key = "edit_lay";

width = 32;

edit_width = 32;

edit_limit = 31;

allow_accept = true;

}

}

}

ok_cancel_err;

}

 

  • 1 mois après...
Posté(e)
Comment dessiner un talus sous autocad lt?

iou existe t'il un outil? jadis avec d'autre version d'autocad s'était faisable qd est il aujourd'hui.?

 

Hello,

 

Tu peux te faire payer LT Extender puis mettre un lisp "Talus" qui traîne par là... Je te fais signe dès que je retrouve...

"La ligne droite est le plus court chemin entre deux points, à condition que les deux points soient bien en face l'un de l'autre" P. Desproges.

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer. Politique de confidentialité