Author Topic: draw similar object lisp  (Read 2327 times)

0 Members and 1 Guest are viewing this topic.

flopo

  • Guest
draw similar object lisp
« on: November 13, 2009, 04:56:48 AM »
Hello everybody,
Here is a routine http://www.cadtutor.net/forum/showthread.php?t=37532&highlight=mapcom
for me thir routine will be perfect if will work for dimension and text also. Any idea??

 

flopo

  • Guest

flopo

  • Guest
draw similar routine
« Reply #2 on: November 13, 2009, 05:33:59 AM »
http://www.cadtutor.net/forum/showthread.php?t=37532&page=4

There is a very usefull routine here. Can anybody modify it to work with dimensions and text also? Thanks!
Code: [Select]
(defun c:MapCom (/ ent Obj lEnt)
  (vl-load-com)
  (while (setq ent (car (nentsel "\nSelect Object: ")))
    (setq Obj (vlax-ename->vla-object ent)
          typ (cdr (assoc 0 (entget ent)))
    )
    (cond ((vl-position typ '("CIRCLE" "ARC" "ELLIPSE" "SPLINE" "XLINE"))
           (comInv typ nil)
           (PropMatch Obj (entlast))
          )
          ((eq "LWPOLYLINE" typ)
           (comInv "pline" nil)
           (PropMatch Obj (entlast))
          )
          ((eq "LINE" typ)
           (setq lEnt (entlast))
           (comInv typ nil)
           (foreach ent (EntCol (if lEnt lEnt (entlast)))
             (PropMatch Obj ent)
           )
          )
          ((eq "HATCH" typ)
           (setq lEnt (entlast))
           (comInv typ t)
           (if (not (eq lEnt (entlast)))
             (PropMatch Obj (entlast))
           )
          )
          ((eq "VIEWPORT" typ)
           (setq lEnt (entlast))
           (comInv "-vports" nil)
           (if (not (eq lEnt (entlast)))
             (PropMatch Obj (entlast))
           )
          )
    )
  )
  (princ)
)

(defun PropMatch (bObj dObj)
  (or (eq 'VLA-OBJECT (type bObj))
      (setq bObj (vlax-ename->vla-object bObj))
  )
  (or (eq 'VLA-OBJECT (type dObj))
      (setq dObj (vlax-ename->vla-object dObj))
  )
  (foreach prop '(Layer             Linetype          LinetypeScale     Color
                  Lineweight        ViewportOn        ShadePlot         DisplayLocked
                  GradientAngle     GradientCentered  GradientColor1    GradientColor2
                  GradientName      HatchObjectType   HatchStyle        ISOPenWidth
                  Origin            PatternAngle      PatternDouble     PatternScale
                  PatternSpace
                 )
    (if (and (vlax-property-available-p bObj prop)
             (vlax-property-available-p dObj prop T)
        )
      (vlax-put-property dObj prop (vlax-get-property bObj prop))
    )
  )
)

(defun EntCol (x / x)
  (if (setq x (entnext x))
    (cons x (EntCol x))
  )
)

(defun comInv (com flag)
  (if flag
    (initdia)
  )
  (command (strcat "_." com))
  (while (eq 1 (logand 1 (getvar "CMDACTIVE")))
    (command pause)
  )
)

<edit: code tags added>
« Last Edit: November 13, 2009, 09:05:16 AM by CAB »

flopo

  • Guest
Re: draw similar object lisp
« Reply #3 on: November 16, 2009, 03:40:31 AM »
This lisp is a nice one. If somebody want to modify it to fit the dimension style and text style, will be perfect!
What about inserting the same block? and then start attribute editing, after insertion? Am I dreaming? Is it possible to be a universal command? :):)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: draw similar object lisp
« Reply #4 on: November 16, 2009, 08:52:42 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: draw similar object lisp
« Reply #5 on: November 16, 2009, 12:19:54 PM »
Also, if you are on subscription, this is available as a subscription bonus pack for 2010.