-
Compteur de contenus
10 663 -
Inscription
-
Dernière visite
-
Jours gagnés
101
Type de contenu
Profils
Forums
Calendrier
Blogs
Tout ce qui a été posté par lecrabe
-
Hello @BETAVENIR 1) REBOOT 2) Ouvrir le DWG principal en Mode RECUPERER et corriger les erreurs 3) Quel Covadis exactement ? 4) Quel AutoCAD / ACAD MAP / ACAD XXXXXX exactement ? Faire la commande: APROPOS < Entree > et nous fournir la copie ecran ... Bye, lecrabe
-
Hello Juste une idee de vacances: tu ne serais pas en train de "melanger" 2 DWGs Covadis avec des Covadis "differents" !? Bye, lecrabe
-
Copie info "géométrique" dans DO d'une polyligne
lecrabe a répondu à un(e) sujet de CT_Ko dans Autodesk Map
Hello @CT_Ko En effet la DLL de Olivier est MAGIQUE ! Sinon voici un vieux Lisp / VLisp "OD_Longueur " frustre mais qui marche sur les LWPOLYLINEs ... Bye, lecrabe ;; ;; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/updating-an-entity-s-object-data/m-p/5451473#M328535 ;; ;; Micro-Adaptation v3 par Patrice B. ;; ;; ATTENTION: aucune gestion d'erreur !!! ;; ;; ;; Routine v2 : Recuperation de la LONGUEUR par OE en VLisp - RAPIDE ;; ;; Routine OD_Longueur par CADaStroumph pour MAP & CIVIL ;; ;; --- Interrogation Entite/Objet en Lisp : (entget (car (entsel)) '("*")) ;; (vl-load-com) (defun C:OD_Longueur ( / js_pl n_pl ent dxf_ent z_pl LONG Table_OD Champ_OD) (princ "\n------ ATTENTION : AUCUNE Gestion d Erreurs ! ------ ") ;;;;;;;; Nom de la Table OD CONCERNEE ;;;;;;;; ;; ( setq Table_OD "BRANCHEM" ) ( setq Table_OD (getstring T "\nNom EXACT de la Table OD (Par exemple: ASS_CANA/etc) : ")) ;;;;;;;; Nom du Champ OD CONCERNE ;;;;;;;; ;; ( setq Champ_OD "long_mes" ) ( setq Champ_OD (getstring T "\nNom EXACT du Champ OD Numerique (Par exemple: LONG/etc) : ")) (setq js_pl (ssget '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (100 . "AcDbPolyline")))) (cond (js_pl (repeat (setq n_pl (sslength js_pl)) (setq ent (ssname js_pl (setq n_pl (1- n_pl)))) (setq dxf_ent (entget ent)) ;;; Recuperation de la LONGUEUR par Patrice en Lisp par AREA - LENT ;;; (command "_.area" "_o" ent) ;;; (setq LONG (getvar "perimeter")) ;;; Recuperation de la LONGUEUR par OE en VLisp - RAPIDE (setq LONG (vla-get-length (vlax-ename->vla-object ent)) ) (setq z_pl LONG) (if z_pl (progn ;;;;;;;; Affectation de la Longueur de la Polyligne dans le champ LONGUEUR de "Table_OD" ;;;;;;;; ( ade_odsetfield ent Table_OD Champ_OD 0 z_pl ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ) ) ) ) ) (princ) ) -
Hello @thierry.garré Question sur les PFMs de Covadis : Faut il qu elles se touchent en XY ? Ou bien faut il les décaler un petit peu 0.5 cm par exemple ? (ou autre distance ?) Merci, Bye, lecrabe
-
TYPES LIGNES INVISIBLES en xref
lecrabe a répondu à un(e) sujet de pedroskull dans AutoCAD 2020-2024
Hello @pedroskull Parfois il peut y avoir une "collision" entre les Types de Ligne d une XREF et ceux du DWG Maître Courant si ils ont le MEME Nom !? Donc tu ouvres ton XREF No 1 : Commande: RENOMMER Type de ligne Ancien nom : * Nouveau nom : XR1_* OK fermer RE-Enregistrer IDEM pour les autres XREFs : XR2 , XR3 , etc Après tu charges le DWG Principal ... As tu toujours le Problème ? Bye, lecrabe -
Hello OUI aujourd hui il faut mettre au minimum avec un Covadis v17.1i ... Ou mieux avec du Covadis v18.0C ou V18.2 ... Bye, lecrabe
-
Exportation de type de ligne AutoCAD ?
lecrabe a répondu à un(e) sujet de pimponpimp dans AutoCAD 2020-2024
Hello Voir l utilitaire LINOUT.VLX ... https://www.cadstudio.cz/en/download.asp?file=linout Bye, lecrabe -
caractère d'échappement dans une sélection
lecrabe a répondu à un(e) sujet de x_all dans Routines LISP
Hello Voir la routine "SelBlocks" VLisp ci-apres qui permet de selectionner N Blocs avec caractere magique par exemple * pour ne donner que une partie COMMUNE du nom ! Bye, lecrabe ;; ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-blocks-by-wildcard/td-p/5923154 ;; ;; Routine: SelBlocks by BeekeeCZ ;; ;; Select Block by the beginning of the Name ... ;; ;; ;; --- Interrogation Entite/Objet en Lisp --- ;; (entget (car (entsel)) '("*")) ;; (vl-load-com) (defun c:SelBlocks ( / bn ss i sn) (if (and (setq bn (getstring "Block Names to Select (For example: BL* -- Case Sensitive !) : ")) (setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," bn)))))) (repeat (setq i (sslength ss)) (if (not (wcmatch (vla-get-effectivename (vlax-ename->vla-object (setq sn (ssname ss (setq i (1- i)))))) bn)) (ssdel sn ss)))) (if ss (sssetfirst nil ss)) (princ) ) -
Hello En évitant les caractères spéciaux / accentues et les Espaces PARTOUT, C FOU le nombre de Bugs / Problemes que l on évite ! Bye, lecrabe
-
Ortho ECW qui ne suit pas sur AutoCAD MAP
lecrabe a répondu à un(e) sujet de Chat dans AutoCAD 2020-2024
Hello Tu as attaché l Image ou tu as fait un MAPIINSERT ? OU Tu as inséré le ECW en FDO par le Driver FDO Raster ? Bye, lecrabe -
Style de trait avec une flèche au bout
lecrabe a répondu à un(e) sujet de PATRICE69 dans AutoCAD 2020-2024
Hello Pas sur de bien te suivre !? Par contre si je farfouille, j ai une routine Lisp qui place un Bloc "Depart" au Debut des Polylignes et aussi un Bloc "Arrivee" a la Fin ! Es tu interesse ? Bye, lecrabe -
Hello @Olivier Eckmann Tu reprends un petit jeune ou une petite jeune !? Bye, lecrabe
-
Hello @Olivier Eckmann Des que ton simulateur nous montre Olivier en action, tu nous partages une video !? Bye, lecrabe
-
autocad debutant - fenetre de sélection de *****
lecrabe a répondu à un(e) sujet de philsogood dans AutoCAD 2020-2024
Hello Ctrl W Bye, lecrabe -
Hello @JMBZ38 Voir ci apres qq rappels sur le Mode ANNOTATIF apparu avec la version 2008 Bye, lecrabe -------- Infos sur les Commandes & Variables liees au Mode ANNOTATIF -------- Par Patrice B -------- Le Mode Annotatif est apparu avec la version 2008 d AutoCAD -------- Vers 1.03 SAVEFIDELITY <0/1> 1 Annotations (Texte, Bloc, Hach, Cotat) en AutoCAD <= 2007 (ACAD 2008) SELECTIONANNODISPLAY <0/1> 1 Annotations Multi-Echelles Visibles / Invisibles (ACAD 2008) ANNOALLVISIBLE <0/1> 1 Afficher/Masquer Objets Annotatifs ne gérant pas l’échelle courante (ACAD 2008) ANNOTATIVEDWG <0/1> = 0 (=1 si DWG Bloc Annotatif) ANNOAUTOSCALE (-4,-3,-2,-1,1,2,3,4) = -4 (ACAD 2008) ANNOTATIVEDWG <0/1> = 1 Indique si le dessin se comportera comme un Bloc Annotatif une fois insere dans un autre dessin : donc c un Bloc Annotatif CANNOSCALE 1:1 1:1 Valeur « NORMALE » si vous n’utilisez pas le mode ANNOTATIF (ACAD 2008) MSLTSCALE <0/1> 1 = 1 : Les Types de ligne affiches dans l'Onglet Objet sont mis à l'Echelle par l'Echelle d'Annotation ;; ;; Commande: ECHELLEOBJET / _OBJECTSCALE ;; Selection des Objets Annotatifs ... ;; PUIS Selection des Echelles Annotatives concernees ... ;; ;; Commande: MODIFLISTECHELLE / _SCALELISTEDIT ;; Consultation / Creation / Suppression des Echelles Annotatives ;; ;; Si AUCUN Objet Annotatif alors SVP supprimer TOUTES les Echelles sauf la "1:1" ;; Car les Echelles Non Utilisees ne sont pas supprimees par la commande PURGER ! ;; ---- Et Une ligne de Lisp importante ---- ---- Pour avoir ANNOALLVISIBLE = 1 dans TOUTES les Presentations / Layouts http://help.autodesk.com/view/ACD/2021/ENU/?guid=GUID-D8E50F6F-FB71-4A20-A3B9-7701C0518B81 Command: (foreach Layout (layoutlist) (command "_.CTAB" Layout "_.ANNOALLVISIBLE" "1")) ---- "Replacement" des Objets Annotatifs ---- Suivre la procedure : - Lancer la commande: REDEFANNOT - Selectionner les Objets Annotatifs concernes ... https://knowledge.autodesk.com/fr/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2017/FRA/AutoCAD-Core/files/GUID-47705AD0-651E-49AA-B23E-D12529D5BA1F-htm.html Retablit les emplacements de TOUTES les representations à l'Echelle des objets d'annotation selectionnes ---- Presentation de l'Echelle d'Annotation ---- https://knowledge.autodesk.com/fr/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2017/FRA/AutoCAD-Core/files/GUID-4F448A62-A99E-4AB5-AE50-9EAAC0485283-htm.html ---- Presentation des Objets d'Annotation ---- https://knowledge.autodesk.com/fr/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2017/FRA/AutoCAD-Core/files/GUID-F8E4E984-71C5-4812-B1A0-3BD0A6BB0BDF-htm.html RAPPEL : Quand on utilise le Mode Annotatif, SVP verifier que vous avez les 3 Icones "Annotatifs" qui sont BIEN affiches en bas sur la ligne d Etat AutoCAD 2015-202X : -- Visibilite de l Annotation -- Echelle automatique -- Echelle d Annotation
-
Var AutoCAD CGEOCS vide quand le DWG est enregistre sous 2025
lecrabe a répondu à un(e) sujet de SuperNoob dans Autodesk Map
Hello Juste une idée sans AutoCAD : un Update AutoCAD 2025 est sorti !? Bye, lecrabe -
Hello Au fait as tu bien le Update AutoCAD 2020.1.6 de septembre 2022 (974 Mo) ? Ensuite peux tu nous fournir ton DWG (ou un extrait par un WBLOC qui pose le meme probleme) par un lien : WETransfert, Download Free, https://www.grosfichiers.com/fr/ , etc Merci, Bye, lecrabe
-
Copier en mode découpe d'un polyligne fermée
lecrabe a répondu à un(e) sujet de PATRICE69 dans Pour aller plus loin en LISP
Hello @PATRICE69 Est ce que le CookieCutter de Kent fonctionne ? Merci, Bye, lecrabe -
Selection par poyligne et decoupe
lecrabe a répondu à un(e) sujet de PATRICE69 dans Pour aller plus loin en LISP
Hello @didier Chef Oui Chef ! Bye, lecrabe CookieCutter2__CC__v12__DEL_ALL_Ouside_or_Inside.zip -
Selection par poyligne et decoupe
lecrabe a répondu à un(e) sujet de PATRICE69 dans Pour aller plus loin en LISP
Hello @PATRICE69 Alors voici une Superbe Routine "CC / CookieCutter2" de Kent qui decoupe a l interieur ou a l exterieur ! Elle traite les Hachures et les Blocs en les explosant, mais bon c deja qq chose ! SVP tu nous raconteras ... Bonne soiree, Bye, lecrabe ;;;; ;;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Delete-everything-within-or-outside-of-a-boundary/td-p/2444510 ;;;; ;; ;; Voir aussi ce sujet legerement different ... ;; https://forums.autodesk.com/t5/autocad-tous-produits-francais/autocad-et-autocad-lt-commande-ajuster-avec-option-ne-pas/td-p/11920771 ;; ;; By Joe Burke -- Routine : CookieCutter2 ou CC ;; Comments and bug reports may be sent to lowercase@hawaii.rr.com. ;; What does CC2 do which ExpressTools extrim, AKA CookieCutter, doesn't? ;; Works with blocks, hatches and regions by exploding them. ;; Other object types which cannot be trimmed are left intact. ;; Works with objects which do not use a Continuous linetype. ;; Offers an option to delete all objects on visible layers either ;; inside or outside the selected trim object. ;; The interface is similar to extrim. ;; First extrim prompt: ;; Pick a POLYLINE, LINE, CIRCLE, ARC, ELLIPSE, IMAGE or TEXT for cutting edge... ;; Select objects: ;; Confusing because the routine does not allow multiple object selection. ;; Plus it works with some object types not mentioned, like splines. ;; First CookieCutter2 prompt: ;; Select circle or closed polyline, ellipse or spline for trimming edge: ;; The object must be closed or appear to be closed. ;; Second extrim prompt: ;; Specify the side to trim on: ;; Second CookieCutter2 prompt: ;; Pick point on side to trim: ;; Third CookieCutter2 prompt: ;; One of the following depending on whether the point picked is inside ;; or outside the trim object. ;; Erase all objects inside? [Yes/No] <N>: ;; Erase all objects outside? [Yes/No] <N>: ;; If Yes, all objects on visible layers are erased. If No it behaves ;; like extrim. ;; Both CC2 and extrim only operate on objects on visible layers. ;; The routine will display an additional prompt if one or more solid ;; hatches intersects the trim object. ;; Convert solid hatch to lines? [Yes/No] <N>: ;; If Yes, solid hatches are converted to lines using the ANSI31 pattern ;; and the lines are trimmed. If No, solid hatches are not trimmed. ;; Miscellaneous Notes: ;; The routine may be used to simply erase all objects inside or ;; outside the trim object. ;; The routine does not trim annotation objects such as text, mtext, ;; dimensions, leaders, mleaders and tables. The user may choose to ;; explode some of these objects types before running the routine. ;; It ignores xrefs. Bind xrefs beforehand if those block objects ;; should be trimmed. ;; Some cleanup may be needed after the routine ends. ;; The routine offsets the selected trim object inside or outside in ;; order to determine trim points. The offset distance is a variable ;; which depends on the size if the trim object. Likewise, if solid ;; hatches are converted to lines, the scale of the ANSI31 pattern ;; depends on the same variable. ;; The routine will end (exit) if offset fails or offset creates more ;; than one new object. Message at the command line: ;; "Problem detected with selected object. Try another. Exiting... " ;; Self-intersecting trim objects are not allowed. The select object ;; part of the routine checks for this and cycles if a self-intersecting ;; object is selected. ;; Version history: ;;; Version 1.0 posted at theswamp 8/26/2008. ;;; Version 1.1 9/25/2008. Minor bug fix to set the correct layer of ;;; an attribute converted to text after exploding a block. ;;; Version 1.2 posted at theswamp 11/28/2008. Fix a bug reported by cjw. ;;; Example, the delete all inside or outside option is chosen. ;;; The end of a line which is inside or outside the trim object ;;; is on the edge of the trim object. The line should be deleted. ;;; It was not before. (defun c:CookieCutter2 ( / *error* *acad* doc ps osm as om emode pmode offd elev locked typ typlst e d notclosed splinetyp i o intpts lst sc minpt maxpt hidelst dellst offsetename offsetobj trimename trimobj curcoord mark postlst coord reg selfinter ext UCSpkpt UCStrimobjpts WCStrimobjpts delother side ssinside ssall sscross ssoutside ssintersect solidflag solidans solidlst sskeep sstest testename WCSoffsetobjpts UCSoffsetobjpts CC:GetScreenCoords CC:TraceObject CC:GetInters CC:SpinBar CC:AfterEnt CC:CommandExplode CC:ExpNestedBlock CC:FirstLastPts CC:GetBlock CC:AttributesToText CC:UniformScale CC:SSVLAList CC:Inside CC:UnlockLayers CC:RelockLayers CC:ZoomToPointList Extents) (defun *error* (msg) (cond ((not msg)) ((wcmatch (strcase msg) "*QUIT*,*CANCEL*")) (T (princ (strcat "\nError: " msg))) ) (setvar "pickstyle" ps) (setvar "osmode" osm) (setvar "autosnap" as) (setvar "edgemode" emode) (setvar "projmode" pmode) (setvar "orthomode" om) (setvar "elevation" elev) (setvar "offsetdist" offd) (setvar "cmdecho" 1) (if (and offsetobj (not (vlax-erased-p offsetobj))) (vla-delete offsetobj) ) (if testename (entdel testename)) (foreach x hidelst (if (not (vlax-erased-p x)) (vlax-put x 'Visible acTrue) ) ) (if (and trimobj (not (vlax-erased-p trimobj))) (vla-highlight trimobj acFalse) ) (CC:RelockLayers locked) (vla-EndUndoMark doc) (princ) ) ;end error ;;;; START SUB-FUNCTIONS ;;;; ;; by Tony Tanzillo ;; Returns the lower left and upper right corners of a point list. (defun Extents (plist) (list (apply 'mapcar (cons 'min plist)) (apply 'mapcar (cons 'max plist)) ) ) ;end ;; Argument: WCS point list. ;; In lieu of (command "zoom" "object"...) which requires 2005 or later. (defun CC:ZoomToPointList (pts) (setq pts (Extents pts)) (vlax-invoke *acad* 'ZoomWindow (car pts) (cadr pts)) (vlax-invoke *acad* 'ZoomScaled 0.85 acZoomScaledRelative) ) ;end ;; Unlock any locked layers in the active file. ;; Returns a list of unlocked layers if any. (defun CC:UnlockLayers (doc / laylst) (vlax-for x (vla-get-Layers doc) ;filter out xref layers (if (and (not (vl-string-search "|" (vlax-get x 'Name))) (eq :vlax-true (vla-get-lock x)) ) (progn (setq laylst (cons x laylst)) (vla-put-lock x :vlax-false) ) ) ) laylst ) ;end ;; Argument: a list of layer objects from CC:UnlockLayers. (defun CC:RelockLayers (lst) (foreach x lst (vl-catch-all-apply 'vla-put-lock (list x :vlax-true)) ) ) ;end ;Returns the coordinates of the current view, lower left and upper right. ;Works in a rotated view. (defun CC:GetScreenCoords ( / ViwCen ViwDim ViwSiz VptMin VptMax) (setq ViwSiz (/ (getvar "VIEWSIZE") 2.0) ViwCen (getvar "VIEWCTR") ViwDim (list (* ViwSiz (apply '/ (getvar "SCREENSIZE"))) ViwSiz ) VptMin (mapcar '- ViwCen ViwDim) VptMax (mapcar '+ ViwCen ViwDim) ) (list VptMin VptMax) ) ;end ;; By John Uhden. Return T if point is inside point list. ;; Check how many intersections found with an "infinite" line (like a ray). ;; If the number intersections is odd, point is inside. ;; If the number intersections is even, point is outside. (defun CC:Inside (p ptlist / p2 i n #) ;; define a point at a sufficiently large distance from p... (setq p2 (polar p 0.0 (distance (getvar "extmin")(getvar "extmax")))) ;; Make sure the ptlist is closed... (if (not (equal (car ptlist) (last ptlist) 1e-10)) (setq ptlist (append ptlist (list (car ptlist)))) ) (setq i 0 # 0 n (1- (length ptlist))) (while (< i n) (if (inters p p2 (nth i ptlist)(nth (1+ i) ptlist)) (setq # (1+ #)) ) (setq i (1+ i)) ) (not (zerop (rem # 2))) ) ; end CC:Inside ;Argument: selection set. ;Returns: list of VLA objects. (defun CC:SSVLAList (ss / obj lst i) (setq i 0) (if ss (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss i)) lst (cons obj lst) i (1+ i) ) ) ) (reverse lst) ) ;end ;; Returns a list of primary enames after ename ent. ;; Filter out sub-entities and entities not in current space. (defun CC:AfterEnt (ent / lst entlst) (while (setq ent (entnext ent)) (setq entlst (entget ent)) (if (and (not (wcmatch (cdr (assoc 0 entlst)) "ATTRIB,VERTEX,SEQEND")) (eq (cdr (assoc 410 entlst)) (getvar "ctab")) ) (setq lst (cons ent lst)) ) ) (reverse lst) ) ;end (defun CC:SpinBar (sbar) (cond ((= sbar "\\") "|") ((= sbar "|") "/") ((= sbar "/") "-") (t "\\") ) ) ;end (defun CC:TraceObject (obj / typlst typ ZZeroList TracePline TraceCE TraceSpline) ;;;; start trace sub-functions ;;;; ;; Argument: 2D or 3D point list. ;; Returns: 3D point list with zero Z values. (defun ZZeroList (lst) (mapcar '(lambda (p) (list (car p) (cadr p) 0.0)) lst) ) ;; Argument: vla-object, a heavy or lightweight pline. ;; Returns: WCS point list if successful. ;; Notes: Duplicate adjacent points are removed. ;; The last closing point is included given a closed pline. (defun TracePline (obj / param endparam anginc tparam pt blg ptlst delta inc arcparam flag) (setq param (vlax-curve-getStartParam obj) endparam (vlax-curve-getEndParam obj) ;anginc (* pi (/ 7.5 180.0)) ;;;; note 7.5 here vs 2.5 at circle anginc (* pi (/ 2.5 180.0)) ;; the two should be the same ) (while (<= param endparam) (setq pt (vlax-curve-getPointAtParam obj param)) ;Avoid duplicate points between start and end. (if (not (equal pt (car ptlst) 1e-12)) (setq ptlst (cons pt ptlst)) ) ;A closed pline returns an error (invalid index) ;when asking for the bulge of the end param. (if (and (/= param endparam) (setq blg (abs (vlax-invoke obj 'GetBulge param))) (/= 0 blg) ) (progn (setq delta (* 4 (atan blg)) ;included angle inc (/ 1.0 (1+ (fix (/ delta anginc)))) arcparam (+ param inc) ) (while (< arcparam (1+ param)) (setq pt (vlax-curve-getPointAtParam obj arcparam) ptlst (cons pt ptlst) arcparam (+ inc arcparam) ) ) ) ) (setq param (1+ param)) ) ;while (if (> (length ptlst) 1) (progn (setq ptlst (vl-remove nil ptlst)) (ZZeroList (reverse ptlst)) ) ) ) ;end ;; Argument: vla-object, an arc, circle or ellipse. ;; Returns: WCS point list if successful. (defun TraceCE (obj / startparam endparam anginc delta div inc pt ptlst) ;start and end angles ;circles don't have StartAngle and EndAngle properties. (setq startparam (vlax-curve-getStartParam obj) endparam (vlax-curve-getEndParam obj) ;;;;;;;;;;;;;; note change here, was using 7.5 ;;;;;;;;;;;;; ;anginc (* pi (/ 7.5 180.0)) ;; This version is from SuperFlatten. ;; I think it returns a tighter trace. anginc (* pi (/ 2.5 180.0)) ) (if (equal endparam (* pi 2) 1e-6) (setq delta endparam) ;added abs 6/23/2007, testing (setq delta (abs (- endparam startparam))) ) ;Divide delta (included angle) into an equal number of parts. (setq div (1+ (fix (/ delta anginc))) inc (/ delta div) ) ;Or statement allows the last point on an open ellipse ;rather than using (<= startparam endparam) which sometimes ;fails to return the last point. Not sure why. (while (or (< startparam endparam) (equal startparam endparam 1e-12) ;(equal startparam endparam) ) (setq pt (vlax-curve-getPointAtParam obj startparam) ptlst (cons pt ptlst) startparam (+ inc startparam) ) ) (ZZeroList (reverse ptlst)) ) ;end (defun TraceSpline (obj / startparam endparam ncpts inc param fd ptlst pt1 pt2 ang1 ang2 a) (setq startparam (vlax-curve-getStartParam obj) endparam (vlax-curve-getEndParam obj) ncpts (vlax-get obj 'NumberOfControlPoints) inc (/ (- endparam startparam) (* ncpts 6)) param (+ inc startparam) fd (vlax-curve-getfirstderiv obj param) ptlst (cons (vlax-curve-getStartPoint obj) ptlst) ) (while (< param endparam) (setq pt1 (vlax-curve-getPointAtParam obj param) ang1 (angle pt1 (mapcar '+ pt1 fd)) param (+ param inc) pt2 (vlax-curve-getPointAtParam obj param) fd (vlax-curve-getfirstderiv obj param) ang2 (angle pt2 (mapcar '+ pt2 fd)) a (abs (@delta ang1 ang2)) ) (if (> a 0.00436332) (setq ptlst (cons pt1 ptlst)) ) ) ;add last point and check for duplicates (if (not (equal (setq pt1 (vlax-curve-getEndPoint obj)) (car ptlst) 1e-8)) (setq ptlst (cons pt1 ptlst)) ) (ZZeroList (reverse ptlst)) ) ;end ;;;; primary trace function ;;;; (setq typlst '("AcDb2dPolyline" "AcDbPolyline" "AcDbSpline" "AcDbCircle" "AcDbEllipse") ) (or (eq (type obj) 'VLA-OBJECT) (setq obj (vlax-ename->vla-object obj)) ) (setq typ (vlax-get obj 'ObjectName)) (if (vl-position typ typlst) (cond ((or (eq typ "AcDb2dPolyline") (eq typ "AcDbPolyline")) (cond ((or (not (vlax-property-available-p obj 'Type)) (= 0 (vlax-get obj 'Type)) ) (TracePline obj) ) ) ) ((or (eq typ "AcDbCircle") (eq typ "AcDbEllipse")) (TraceCE obj) ) ((eq typ "AcDbSpline") (TraceSpline obj) ) ) ) ) ;end CC:TraceObject ; Arguments: ; firstobj: first object - ename or vla-object ; nextobj: second object - ename or vla-object ; mode - extend options ; acExtendNone: extend neither object ; acExtendThisEntity: extend first object ; acExtendOtherEntity: extend second object ; acExtendBoth: extend both objects ; Returns a WCS point list or nil if intersection not found. (defun CC:GetInters (firstobj nextobj mode / coord ptlst) (if (= (type firstobj) 'ENAME) (setq firstobj (vlax-ename->vla-object firstobj))) (if (= (type nextobj) 'ENAME) (setq nextobj (vlax-ename->vla-object nextobj))) (if (not (vl-catch-all-error-p (setq coord (vl-catch-all-apply 'vlax-invoke (list firstobj 'IntersectWith nextobj mode))) ) ) (repeat (/ (length coord) 3) (setq ptlst (cons (list (car coord) (cadr coord) (caddr coord)) ptlst)) (setq coord (cdddr coord)) ) ) (reverse ptlst) ) ;end ;; Note 7/24/2008, saw the annonymous *E81 block thing again as in ;; SuperFlatten. It happens when trying to explode an NUS block. ;; In this case a grid block (was xref bound) was NUS. The grid lines ;; were exploded, but the column blocks inside it were not. ;; All of them were placed in the *E81 block. ;; I suppose there might be a report about this. At the end you could ;; check the blocks which remain in the drawing. If any has a name ;; like *E81, report, "A non-uniformly scaled block could not be exploded." (defun CC:CommandExplode (obj / lay mark attlst name exlst newattlst) (setq mark (entlast)) (if (and (not (vlax-erased-p obj)) (eq "AcDbBlockReference" (vlax-get obj 'ObjectName)) ) (progn (setq lay (vlax-get obj 'Layer) attlst (vlax-invoke obj 'GetAttributes) ) (vl-cmdf "._explode" (vlax-vla-object->ename obj)) ;; Is this still fixing error in error handler? ;; Yes it is IMPORTANT! (command) (if (and (not (eq mark (entlast))) (setq exlst (CC:SSVLAList (ssget "_p"))) ) (progn (setq newattlst (CC:AttributesToText attlst)) (foreach x exlst (if (eq "AcDbAttributeDefinition" (vlax-get x 'ObjectName)) (vla-delete x) ) ) (setq exlst (vl-remove-if 'vlax-erased-p exlst)) (if newattlst (setq exlst (append exlst newattlst))) ;If an exlpoded object is on layer 0, put it on the ;layer of the exploded object. If its color is byBlock, ;change color to byLayer. (foreach x exlst (if (eq "0" (vlax-get x 'Layer)) (vlax-put x 'Layer lay) ) (if (zerop (vlax-get x 'Color)) (vlax-put x 'Color 256) ) ) ) ) ) ) ;if ;(setq exlst (vl-remove-if 'vlax-erased-p exlst)) (foreach x exlst (if (and (not (vlax-erased-p x)) (eq "AcDbBlockReference" (vlax-get x 'ObjectName)) ) (CC:ExpNestedBlock x) ) ) ) ;end CC:CommandExplode ;; Argument: block reference vla-object. ;; Explode the block passed and any nested blocks. ;; Doesn't deal with attributes yet. Convert to text. ;; Based on code by TW-Vacation at theswamp. ;; Leave this function as is. Trying to condense it ;; will only cause problems. (defun CC:ExpNestedBlock (obj / lay lst attlst) ;; Do SpinBar here because exploding many blocks is what ;; causes the routine to take a long time in some cases. (princ (strcat "\rProcessing blocks... " (setq *sbar (CC:SpinBar *sbar)) "\t") ) (if (and obj (not (vlax-erased-p obj)) ) (cond ((not (CC:UniformScale obj)) (CC:CommandExplode obj) ) (T (setq lay (vlax-get obj 'Layer)) (if (eq "AcDbBlockReference" (vlax-get obj 'ObjectName)) (setq attlst (CC:AttributesToText (vlax-invoke obj 'GetAttributes))) ) ;; This is primarily intended to catch NUS blocks which ;; the explode method can't handle. (setq lst (vl-catch-all-apply 'vlax-invoke (list obj 'Explode))) (if attlst (setq lst (append lst attlst))) (if (listp lst) (foreach x lst ;; This update call is important! (vla-update x) ;testing (if (eq "AcDbBlockReference" (vlax-get x 'ObjectName)) (CC:ExpNestedBlock x) (progn (if (and (not (vlax-erased-p x)) (eq "0" (vlax-get x 'Layer)) ) (vlax-put x 'Layer lay) ) ;; If color is byblock, change to bylayer. (if (and (not (vlax-erased-p x)) (zerop (vlax-get x 'Color)) ) (vlax-put x 'Color 256) ) (if (and (not (vlax-erased-p x)) (eq "AcDbAttributeDefinition" (vlax-get x 'ObjectName)) ) (vla-delete x) ) ) ) ) ) (vla-delete obj) ) ) ;cond ) ;if ) ;end ;; Allow an object which is not closed, but has equal first and last points, ;; to pass the test. (defun CC:FirstLastPts (obj / p1 p2) (setq p1 (vlax-curve-getPointAtParam obj (vlax-curve-getStartParam obj))) (setq p2 (vlax-curve-getPointAtParam obj (vlax-curve-getEndParam obj))) (equal p1 p2 1e-10) ) (defun CC:GetBlock () (vlax-get (vla-get-ActiveLayout doc) 'Block) ) ;end ;; Convert a list of attribute reference objects to text objects. ;; The list returned is used in CC:ExpNestedBlock. (defun CC:AttributesToText (attlst / elst res) (foreach x attlst (setq elst (entget (vlax-vla-object->ename x))) (if (entmake (list '(0 . "TEXT") (cons 1 (vlax-get x 'TextString)) (cons 7 (vlax-get x 'StyleName)) (cons 8 (vlax-get x 'Layer)) (cons 10 (vlax-get x 'InsertionPoint)) (cons 11 (vlax-get x 'TextAlignmentPoint)) (cons 40 (vlax-get x 'Height)) (cons 41 (vlax-get x 'ScaleFactor)) (cons 50 (vlax-get x 'Rotation)) (cons 51 (vlax-get x 'ObliqueAngle)) (cons 62 (vlax-get x 'Color)) (cons 67 (cdr (assoc 67 elst))) (cons 71 (cdr (assoc 71 elst))) (cons 72 (cdr (assoc 72 elst))) (cons 73 (cdr (assoc 73 elst))) (cons 410 (cdr (assoc 410 elst))) ) ) ;make (setq res (cons (vlax-ename->vla-object (entlast)) res)) ) ) res ) ;end ;; Return T ig block is uniformly scaled within fuzz range. (defun CC:UniformScale (obj / x y z) (and (or (= (type obj) 'VLA-object) (if (= (type obj) 'ENAME) (setq obj (vlax-ename->vla-object obj)) ) ) (or (wcmatch (vlax-get obj 'ObjectName) "*Dimension") (and (= "AcDbBlockReference" (vlax-get obj 'ObjectName)) (setq x (vlax-get obj 'XScaleFactor)) (setq y (vlax-get obj 'YScaleFactor)) (setq z (vlax-get obj 'ZScaleFactor)) (and ;; this fuzz 1e-8 seems sufficient for this application ;; it does not involve transformby which seems more sensitive ;; to NUS blocks (equal (abs x) (abs y) 1e-8) (equal (abs y) (abs z) 1e-8) ) ) ) ) ) ;end ;; Added 7/28/2008 ;; Arguments: ename or vla-object and an intersection point list. ;; Returns: the original point list if an error occurs due to object type. ;; Otherwise the point list sorted by param at point along the curve. ;; Notes: the order of the point list returned by IntersectWith is ;; unpredictable. Sorting the point list allows multiple trim operations ;; on an object to occur in more predictable fashion. (defun SortInterPoints (obj pts / lst) (if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getEndParam (list obj)) ) pts (progn (setq lst (mapcar '(lambda (y) (vlax-curve-getParamAtPoint obj y)) pts) lst (mapcar '(lambda (y z) (list y z)) lst pts) lst (vl-sort lst '(lambda (a b) (< (car a) (car b)))) ) (mapcar 'cadr lst) ) ) ) ;end ;;;; END SUB-FUNCTIONS ;;;; ;;;; START MAIN FUNCTION ;;;; (vl-load-com) (setq *acad* (vlax-get-acad-object) doc (vla-get-ActiveDocument *acad*) ) (vla-StartUndoMark doc) (setq locked (CC:UnlockLayers doc)) ;; Avoid problems with groups. (setq ps (getvar "pickstyle")) (setvar "pickstyle" 0) (setvar "cmdecho" 0) (setq elev (getvar "elevation")) ;; So the Z value of the point picked (inside or outside) ;; is not at the current elevation. (setvar "elevation" 0.0) (setq osm (getvar "osmode")) (setvar "osmode" 0) ;; polar and ortho should be off too? (setq as (getvar "autosnap")) (setvar "autosnap" 0) (setq om (getvar "orthomode")) (setvar "orthomode" 0) ;; These following added 8/14/2008 (setq emode (getvar "edgemode")) (setvar "edgemode" 0) (setq pmode (getvar "projmode")) (setvar "projmode" 0) (setq offd (getvar "offsetdist")) (sssetfirst) (setq typlst '("AcDbCircle" "AcDbPolyline" "AcDb2dPolyline" "AcDbEllipse" "AcDbSpline")) (setvar "errno" 0) (while (or (not (setq e (car (entsel "\nSelect circle or closed polyline, ellipse or spline for trimming edge: ")))) (not (setq trimobj (vlax-ename->vla-object e))) (not (vl-position (setq typ (vlax-get trimobj 'ObjectName)) typlst)) (and (not (CC:FirstLastPts trimobj)) (setq notclosed T) ) (and (wcmatch typ "*Polyline") (vlax-property-available-p trimobj 'Type) (not (zerop (vlax-get trimobj 'Type))) (setq splinetyp T) ) ;; Test for self-intersecting pline or spline. ;; Concept by Tony Tanzillo. If region fails the object ;; probably intersects itself. Seems reliable so far. (and (wcmatch typ "*Polyline,AcDbSpline") (vl-catch-all-error-p (setq reg (vl-catch-all-apply 'vlax-invoke (list (CC:GetBlock) 'AddRegion (list trimobj)) ) ) ) (setq selfinter T) ) ) (cond ((= 52 (getvar "errno")) (exit) ) ((not e) (princ "\n Missed pick. ") ) (selfinter (princ "\n Selected object intersects itself, try again. ") (setq selfinter nil) ) (notclosed (princ "\n Selected object is not closed, try again. ") (setq notclosed nil) ) (splinetyp (princ "\n Polyline spline selected, try again. ") (setq splinetyp nil) ) (typ (princ (strcat "\n " (substr typ 5) " selected, try again. ")) (setq typ nil) ) ) ) ;; Delete region if one was created. (if (and reg (not (vl-catch-all-error-p reg)) ) (vla-delete (car reg)) ) (setq trimename (vlax-vla-object->ename trimobj)) ;; View to restore at end. (setq curcoord (CC:GetScreenCoords)) ;; Highlighting the trim object helps in crouded situations. (vla-highlight trimobj acTrue) (initget 1) (setq UCSpkpt (getpoint "\nPick point on side to trim: ")) (setq WCStrimobjpts (CC:TraceObject trimobj)) (setq UCStrimobjpts (mapcar '(lambda (x) (trans x 0 1)) WCStrimobjpts) ) (if (CC:Inside UCSpkpt UCStrimobjpts) (setq side "inside") (setq side "outside") ) (setq ext (Extents WCStrimobjpts)) (setq d (distance (car ext) (cadr ext))) ;; d is used below to specify offset distance. (setq d (/ d 1500.0)) ;; testing for decimal units ;; initial test indicates this may be needed ;; An exploded hatch was trimmed better with this. ;; Keep this for now. (if (= 2 (getvar "lunits")) (setq d (/ d 12.0)) ) (setq mark (entlast)) (vl-cmdf "._offset" d (vlax-vla-object->ename trimobj) UCSpkpt "_exit") (setq offsetename (entlast)) (if (/= 1 (length (setq dellst (CC:AfterEnt mark)))) (progn (princ "\nProblem detected with selected object. Try another. Exiting... ") ;; If offset created multiple objects they need to be deleted. ;; This can happen with a spline. ;; Also exit if offset failed. (foreach x dellst (entdel x)) (exit) ) ) (setq offsetobj (vlax-ename->vla-object offsetename)) (vlax-put offsetobj 'Visible 0) (setq hidelst (cons offsetobj hidelst)) (initget "Yes No") (setq delother (getkword (strcat "\nErase all objects " side "? [Yes/No] <N>: "))) (if (not delother) (setq delother "No")) (vlax-invoke *acad* 'ZoomExtents) (setq sc (CC:GetScreenCoords)) ;; These are 2D points. (setq minpt (car sc)) (setq maxpt (cadr sc)) ;; This must follow zoom extents. (vlax-put trimobj 'Visible 0) (setq hidelst (cons trimobj hidelst)) ;; Explode blocks which intersect the trim object first. ;; Deal with hatches and regions afterwards. ; (setq sscross (ssget "cp" UCStrimobjpts '((0 . "INSERT")))) (setq sscross (ssget "_cp" UCStrimobjpts '((0 . "INSERT")))) ; (if (not (setq ssinside (ssget "wp" UCStrimobjpts '((0 . "INSERT"))))) (if (not (setq ssinside (ssget "_wp" UCStrimobjpts '((0 . "INSERT"))))) (setq ssinside (ssadd)) ) (setq i 0) (if sscross (repeat (sslength sscross) (setq e (ssname sscross i)) (if (and (not (ssmemb e ssinside)) (setq o (vlax-ename->vla-object e)) (not (vlax-erased-p o)) (vlax-property-available-p o 'Path) ) (progn ;; Hiding true xrefs here. If the block was not ;; erased/explode above then hide it. The reason for ;; this nonsense method is sometimes after an xref ;; is bound, AutoCAD thinks it is still an xref. ;; There's no way to test for this condition AFAIK. ;; (Command "explode"...) can explode a false xref. ;; So this cond passes all xref blocks to the ;; CommandExplode function. If it fails to explode ;; then make the xref invisible. Note, there will be a ;; non-fatal message generated within the CommandExplode ;; function when the block is really an xref. ;; "The object is an external reference." ;; Just have to live with that. ;; Also, the explode method cannot be used on false xrefs. ;; The reason for attention to this problem is the user ;; may bind xrefs before running the routine. (CC:CommandExplode o) (if (not (vlax-erased-p o)) (progn (vlax-put o 'Visible 0) (setq hidelst (cons o hidelst)) ) ) ) ;else (CC:ExpNestedBlock o) ) (setq i (1+ i)) ) ) ;; Solid hatches... (setq i 0 sscross nil ssinside nil) ; (setq sscross (ssget "cp" UCStrimobjpts '((0 . "HATCH")))) (setq sscross (ssget "_cp" UCStrimobjpts '((0 . "HATCH")))) ; (if (not (setq ssinside (ssget "wp" UCStrimobjpts '((0 . "HATCH"))))) (if (not (setq ssinside (ssget "_wp" UCStrimobjpts '((0 . "HATCH"))))) (setq ssinside (ssadd)) ) ;; Just check for solid hatces. (if sscross (repeat (sslength sscross) (setq e (ssname sscross i)) (if (and (not (ssmemb e ssinside)) (setq o (vlax-ename->vla-object e)) (eq "AcDbHatch" (vlax-get o 'ObjectName)) (eq "SOLID" (vlax-get o 'PatternName)) ) (setq solidflag T solidlst (cons e solidlst) ) ) (setq i (1+ i)) ) ) ;if (if solidflag (progn (initget "Yes No") (setq solidans (getkword "\nConvert solid hatch to lines? [Yes/No] <N>: ")) (if (eq "Yes" solidans) (foreach x solidlst ;; check for erased? (command "._-hatchedit" x "_properties" "ANSI31" (* d 8) 0.0) ;; Prevent message, "Hatch boundary associativity removed." (vlax-put (vlax-ename->vla-object x) 'AssociativeHatch 0) (command "._explode" x) ) ) ) ) ;; Now regions and not solid hatches. (setq i 0 sscross nil ssinside nil) ; (setq sscross (ssget "cp" UCStrimobjpts '((0 . "HATCH,REGION")))) (setq sscross (ssget "_cp" UCStrimobjpts '((0 . "HATCH,REGION")))) ; (if (not (setq ssinside (ssget "wp" UCStrimobjpts '((0 . "HATCH,REGION"))))) (if (not (setq ssinside (ssget "_wp" UCStrimobjpts '((0 . "HATCH,REGION"))))) (setq ssinside (ssadd)) ) ;; Ignore solid hatches. If any still exist the user answered No to question. (if sscross (repeat (sslength sscross) (setq e (ssname sscross i)) (if (and (not (ssmemb e ssinside)) (not (vl-position e solidlst)) ) (progn ;; Prevent message, "Hatch boundary associativity removed." (setq o (vlax-ename->vla-object e)) (if (vlax-property-available-p o 'AssociativeHatch) (vlax-put o 'AssociativeHatch 0) ) (command "._explode" e) ) ) (setq i (1+ i)) ) ) (setq sscross nil ssinside nil) ;; Note: xrefs and the trim object are invisible at this point ;; so they are not included in following selections. ; (setq ssall (ssget "c" minpt maxpt)) (setq ssall (ssget "_c" minpt maxpt)) ;; Selection set of objects completely inside trimobj. ; (if (not (setq ssinside (ssget "wp" UCStrimobjpts))) (if (not (setq ssinside (ssget "_wp" UCStrimobjpts))) (setq ssinside (ssadd)) ) ;; Selection set of all objects crossing trimobj. ; (if (not (setq sscross (ssget "cp" UCStrimobjpts))) ;var added (if (not (setq sscross (ssget "_cp" UCStrimobjpts))) ;var added (setq sscross (ssadd)) ) ;; now ssoutside can be set (setq i 0) (setq ssoutside (ssadd)) (repeat (sslength ssall) (setq e (ssname ssall i)) (if (not (ssmemb e sscross)) (ssadd e ssoutside) ) (setq i (1+ i)) ) ;; ssintersect - objects which intersect the trim object. (setq i 0) (setq ssintersect (ssadd)) (repeat (sslength sscross) (setq e (ssname sscross i)) (if (and (not (ssmemb e ssinside)) (not (vl-position e solidlst)) ;; Added intersect test 8/7/2008. ;; Was removed, put back 8/19/2008. Seems OK. ;; If the following returns nil then trim will fail. ;; "Cannot TRIM this object." This can happen with ;; some unusual spline objects. (CC:GetInters e trimobj acExtendNone) ;(not (eq e trimename)) ) (ssadd e ssintersect) (ssadd e ssinside) ) (setq i (1+ i)) ) ;; Added check 8/22/2008. ;; Likely only applies to an ellipse as trim object. ;; An ellipse is converted to a spline when offset. ;; For some unknown reason the trim object may be ;; included in the objects which are erased. It should not ;; happen since the trim object is invisible as this point. ;; Regardless, this check fixes a bug which may cause the ;; trim object to be erased. Which in turn causes other problems. (if (eq "Yes" delother) (cond ((eq side "inside") (ssdel trimename ssinside) ;check (command "._erase" ssinside "") ) ((eq side "outside") (ssdel trimename ssoutside) ;check (command "._erase" ssoutside "") ) ) ) ;; List of VLA-objects which intersect the trim object. (setq lst (CC:SSVLAList ssintersect)) ;; Remove these object types from list to trim. ;; There is error checking elsewhere which should prevent ;; errors with other object types which cannot be trimmed. ;; Note 8/17/2008 - the only hatches which still exist are ;; solid hatches which the user chose not to convert to lines. ;; So hatches can be added here. (setq lst (vl-remove-if '(lambda (x) (setq typ (vlax-get x 'ObjectName)) (or (eq "AcDbText" typ) (eq "AcDbMText" typ) (eq "AcDbLeader" typ) (wcmatch typ "*Dimension") (eq "AcDbHatch" typ) ;; added 8/17/2008 (eq "AcDbSolid" typ) (eq "AcDbTrace" typ) (eq "AcDbMLeader" typ) ;; Likely not needed, Added 8/22/2008. (eq trimobj x) ) ) lst ) ) (CC:ZoomToPointList WCStrimobjpts) ;;; Start primary loop ;;; (foreach x lst ;; Helps with trimming closed plines. (if (not (vlax-erased-p x)) (progn (setq typ (vlax-get x 'ObjectName)) (cond ((and (eq "AcDbPolyline" typ) (= -1 (vlax-get x 'Closed)) ) (vlax-put x 'Closed 0) (setq coord (vlax-get x 'Coordinates)) (vlax-put x 'Coordinates (append coord (list (car coord) (cadr coord))) ) (vla-update x) ) ((and (eq "AcDb2dPolyline" typ) (= -1 (vlax-get x 'Closed)) ) (vlax-put x 'Closed 0) (setq coord (vlax-get x 'Coordinates)) (vlax-put x 'Coordinates (append coord (list (car coord) (cadr coord) (caddr coord))) ) (vla-update x) ) ) ) ) (if (setq intpts (CC:GetInters offsetobj x acExtendNone)) (progn ;; More than two points seems good here and below. (if (> (length intpts) 2) (setq intpts (SortInterPoints x intpts)) ) (foreach p intpts (setq mark (entlast)) (if (and (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getParamAtPoint (list x p))) ) (vlax-curve-getParamAtPoint x p) ) (vl-cmdf "._trim" trimename "" (list (vlax-vla-object->ename x) (trans p 0 1)) "") ) (if (not (eq mark (entlast))) (setq postlst (cons (entlast) postlst)) ) ) ) ) ) ;;; End primary loop ;;; ;; This part trims any new objects created above. (while postlst (setq intpts nil) (foreach x postlst (if (setq intpts (CC:GetInters offsetobj x acExtendNone)) (progn (if (> (length intpts) 2) (setq intpts (SortInterPoints x intpts)) ) (foreach p intpts (setq mark nil) ; is this needed? (setq mark (entlast)) (if (and (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getParamAtPoint (list x p))) ) (vlax-curve-getParamAtPoint x p) ) (vl-cmdf "._trim" trimename "" (list x (trans p 0 1)) "") ) (setq postlst (vl-remove x postlst)) (if (not (eq mark (entlast))) (setq postlst (cons (entlast) postlst)) ) ) (setq postlst (vl-remove x postlst)) ) (setq postlst (vl-remove x postlst)) ) ) ) ;; Following code added in version 1.2 which deals with left over ;; objects either inside or outside the trim object which should be erased. (if (and (eq "Yes" delother) trimobj offsetobj (not (CC:GetInters offsetobj trimobj acExtendNone)) ) (cond ((and (eq side "inside") (setq WCSoffsetobjpts (CC:TraceObject offsetobj)) (setq UCSoffsetobjpts (mapcar '(lambda (x) (trans x 0 1)) WCSoffsetobjpts) ) ) (if (setq sstest (ssget "_cp" UCSoffsetobjpts)) (command "._erase" sstest "") ) ) ((eq side "outside") (setq mark (entlast)) ;; multiply be 2 or 3? (vl-cmdf "._offset" (* d 3) offsetename UCSpkpt "_exit") (if (and (not (eq mark (setq testename (entlast)))) (not (CC:GetInters testename trimobj acExtendNone)) (setq WCSoffsetobjpts (CC:TraceObject testename)) (setq UCSoffsetobjpts (mapcar '(lambda (x) (trans x 0 1)) WCSoffsetobjpts) ) ) (progn (setq sskeep (ssget "_wp" UCSoffsetobjpts)) (vlax-invoke *acad* 'ZoomExtents) (setq sc (CC:GetScreenCoords) minpt (car sc) maxpt (cadr sc) sstest (ssget "_c" minpt maxpt) i 0 ) (if (and sskeep sstest (> (sslength sstest) (sslength sskeep)) ) (repeat (sslength sstest) (setq e (ssname sstest i)) (if (not (ssmemb e sskeep)) (entdel e) ) (setq i (1+ i)) ) ) ) ) ) ) ;cond ) ;if ;; Zoom to original view. (command "._zoom" "_window" (car curcoord) (cadr curcoord)) (*error* nil) ) ;end ;------------------------------------ ;shortcut (defun c:CC () (c:CookieCutter2)) ;------------------------------------ -
[Résolu]Comment éviter ce genre de "bug" sur une polyligne fermée
lecrabe a répondu à un(e) sujet de Dilack33 dans AutoCAD 2020-2024
Hello @Dilack33 Voici une routine "PLWO" VLisp de Kent qui dessine les 2 Polylignes "gauche-droite" de N LWPOLYLINEs (avec segment et/ou arc) ayant une Largeur globale NON NULLE ATTENTION 1 : la routine PLWO supprime les N LWPOLYLINEs originales ... DONC il faut travailler sur une copie des N LWPOLYLINEs ... Copiees en Ortho a 1000/2000m ... ATTENTION 2 : Et aussi elle cree les nouvelles LWPOLYLINEs sur le calque origine des LWPOLYLINEs selectionnees et non pas sur le calque courant ! Bon dimanche, Bye, lecrabe ;; ;; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/convert-polylines-into-double-lines-with-hatch/m-p/5844082#M335741 ;; ;; PLWtoOutline.lsp [command name: PLWO] ;; ;; To convert lightweight PolyLines with global Width to closed outlining Polylines ;; without width, tracing the edges of the selected Polylines and closing their ends. ;; ;; For closed Polylines, results in two Polylines tracing edges of original (does not ;; connect their ends, and, of course, cannot join them together). ;; ;; Ignores non-Polylines, those with zero or varying width, and those on locked layers. ;; Works with Polylines in different Coordinate Systems. ;; ;; Kent Cooper, last edited 1 October 2015 ;; (defun C:PLWO (/ *error* doc osm plset pl pldata ucschanged offs pljoin plobj) (defun *error* (errmsg) (if (wcmatch errmsg "Function cancelled,quit / exit abort,console break") (princ (strcat "\nError: " errmsg))) (if ucschanged (command "_.ucs" "_prev")); don't go back unless routine changed UCS but didn't change it back yet (setvar 'osmode osm) (setvar 'cmdecho cmde) (vla-endundomark doc) ); defun - *error* (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (setq osm (getvar 'osmode) cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) (setvar 'osmode 0) (prompt "\nTo change PLines with global Width to outline PLines tracing their edges,") (setq plset (ssget "_:L" '((0 . "LWPOLYLINE")))); [(ssget) provides its own Select objects: prompt] (while (> (sslength plset) 0); as long as there's still something in the set (setq pl (ssname plset 0); get the first item pldata (entget pl); and its entity data ); setq (if (> (cdr (assoc 43 pldata)) 0.0); it has a non-zero global width (progn ; then - process this Polyline (command "_.ucs" "_new" "_object" pl) ; set UCS to match object (setq ucschanged T ; for use in *error* function if UCS does not get reset offs (/ (cdr (assoc 43 pldata)) 2); half of Pline's global width pljoin (ssadd); start initially empty set of items to join together plobj (vlax-ename->vla-object pl) ); setq (vla-put-ConstantWidth plobj 0.0) (vla-offset plobj offs) (ssadd (entlast) pljoin) (vla-offset plobj (- offs)) (ssadd (entlast) pljoin) (entdel pl) ;; eliminate original (if (not (vlax-curve-isClosed (entlast))); open-ended - close ends & join (progn (setvar 'clayer (cdr (assoc 8 pldata))) (command "_.line" (trans (vlax-curve-getStartPoint (ssname pljoin 0)) 0 1) (trans (vlax-curve-getStartPoint (ssname pljoin 1)) 0 1) "" ); command (ssadd (entlast) pljoin) (command "_.line" (trans (vlax-curve-getEndPoint (ssname pljoin 0)) 0 1) (trans (vlax-curve-getEndPoint (ssname pljoin 1)) 0 1) "" ); command (ssadd (entlast) pljoin) (command "_.pedit" (ssname pljoin 0) "_join" pljoin "" "" "_.layerp" ) ; command ); progn ); if (command "_.ucs" "_prev"); reset UCS (setq ucschanged nil); eliminate reset in *error* function ); progn ); if (ssdel pl plset) ;; remove from set, and... ); while - ...go back and do next one if appropriate (setvar 'osmode osm) (setvar 'cmdecho cmde) (vla-endundomark doc) (princ) ); defun (vl-load-com) (prompt "\nType PLWO to change PLines with Global Width to Outlines tracing their edges ") -
Hello @Olivier Eckmann Et tu as seulement 32 Go Ram et non pas 64 !? Une RTX 4060 8 Go permet deja de travailler correctement en theorie !? Sinon en effet il me plait bien ! Bye, lecrabe
-
Hello OK donc une RTX 4070 Super sera OK ! Bye, lecrabe
-
Hello @yusukens82 SVP tu utilises quels logiciels ? Bye, lecrabe
-
Sélection dans le vide d'un pointillé
lecrabe a répondu à un(e) sujet de yusukens82 dans AutoCAD 2020-2024
Hello @yusukens82 LTGAPSELECTION = 0/1/2 Est une nouveauté discrète de la version 2017 ! Bye, lecrabe
