Author Topic: Possible?: batch remove dynamic block "alignment parameter"  (Read 1928 times)

0 Members and 1 Guest are viewing this topic.

bilançikur

  • Newt
  • Posts: 82
Possible?: batch remove dynamic block "alignment parameter"
« on: October 30, 2012, 05:11:36 AM »
I was wondering if it would be possible to "delete the alignment parameter" in a block by lisp by batch. I have my block library (250+ blocks) stored somewhere on the C: drive and every single block has got a dynamic alignment parameter. I want to process all these blocks so the parameters are gone.

In stead of opening each dwg I would like to perform a batch, but is that possible? If yes... how? If no, I will go manual :-)

Thank you.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Possible?: batch remove dynamic block "alignment parameter"
« Reply #1 on: November 09, 2012, 05:03:18 AM »
As long as you're inside the BEdit environment, you can simply use entnext to step through all the entities there. The parameter definitions are the only entities which return only the ename item if you run entget on them. E.g. here's a block containing a rectangle and one alignment parameter:
Code: [Select]
Command: (entget (setq en (entnext)))
((-1 . <Entity name: 7ffff6f8530>) (0 . "VIEWPORT") (330 . <Entity name: 7ffff6f8510>) (5 . "1FB") (100 . "AcDbEntity") (67 . 1) (410 . "Work") (8 . "0") (100 . "AcDbViewport") (10 413.006 277.008 0.0) (40 . 1124.54) (41 . 560.602) (68 . 2) (69 . 1) (12 413.006 277.008 0.0) (13 0.0 0.0 0.0) (14 12.0 12.0 0.0) (15 120.0 120.0 0.0) (16 0.0 0.0 1.0) (17 0.0 0.0 0.0) (42 . 50.0) (43 . 0.0) (44 . 0.0) (45 . 560.602) (50 . 0.0) (51 . 0.0) (72 . 10000) (90 . 32800) (281 . 0) (71 . 1) (74 . 0) (110 0.0 0.0 0.0) (111 1.0 0.0 0.0) (112 0.0 1.0 0.0) (79 . 0) (146 . 0.0) (170 . 0) (61 . 5) (348 . <Entity name: 7ffff65ef50>) (292 . 1) (282 . 1) (141 . 0.0) (142 . 0.0) (63 . 250) (421 . 3355443))
Command: (entget (setq en (entnext en)))
((-1 . <Entity name: 7ffff63f3e0>) (0 . "VIEWPORT") (5 . "BCE") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 7ffff690a00>) (102 . "}") (330 . <Entity name: 7ffff6f8510>) (100 . "AcDbEntity") (67 . 1) (410 . "Work") (8 . "Defpoints") (100 . "AcDbViewport") (10 206.5 277.0 0.0) (40 . 413.0) (41 . 554.0) (68 . 3) (69 . 2) (12 4313.35 19391.8 0.0) (13 0.0 0.0 0.0) (14 1.0 1.0 0.0) (15 3000.0 3000.0 0.0) (16 -1.0 -1.0 1.0) (17 0.0 0.0 0.0) (42 . 50.0) (43 . 0.0) (44 . 0.0) (45 . 90862.0) (50 . 0.0) (51 . 0.0) (72 . 10000) (90 . 33568) (281 . 0) (71 . 1) (74 . 0) (110 0.0 0.0 0.0) (111 1.0 0.0 0.0) (112 0.0 1.0 0.0) (79 . 0) (146 . 0.0) (170 . 0) (61 . 5) (348 . <Entity name: 7ffff65ef50>) (292 . 1) (282 . 1) (141 . 0.0) (142 . 0.0) (63 . 250) (421 . 3355443))
Command: (entget (setq en (entnext en)))
((-1 . <Entity name: 7ffff65e380>) (0 . "VIEWPORT") (5 . "1040") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 7ffff690a20>) (102 . "}") (330 . <Entity name: 7ffff6f8510>) (100 . "AcDbEntity") (67 . 1) (410 . "Work") (8 . "Defpoints") (100 . "AcDbViewport") (10 619.5 277.0 0.0) (40 . 413.0) (41 . 554.0) (68 . 1) (69 . 3) (12 26800.0 20700.0 0.0) (13 0.0 0.0 0.0) (14 1.0 1.0 0.0) (15 3000.0 3000.0 0.0) (16 0.0 0.0 1.0) (17 0.0 0.0 0.0) (42 . 50.0) (43 . 0.0) (44 . 0.0) (45 . 72755.3) (50 . 0.0) (51 . 0.0) (72 . 10000) (90 . 33568) (281 . 0) (71 . 1) (74 . 0) (110 0.0 0.0 0.0) (111 1.0 0.0 0.0) (112 0.0 1.0 0.0) (79 . 1) (146 . 0.0) (170 . 0) (61 . 5) (348 . <Entity name: 7ffff65ef50>) (292 . 1) (282 . 1) (141 . 0.0) (142 . 0.0) (63 . 250) (421 . 3355443))
Command: (entget (setq en (entnext en)))
((-1 . <Entity name: 7ffff659f50>) (0 . "LWPOLYLINE") (330 . <Entity name: 7ffff6fb9f0>) (5 . "37DD") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 41512.0 13772.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 60178.0 13772.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 60178.0 30968.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 41512.0 30968.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))
Command: (entget (setq en (entnext en)))
((-1 . <Entity name: 7ffff64d050>))
Command: (setq en1 en)
<Entity name: 7ffff64d050>
Command: (entget (setq en (entnext en)))
((-1 . <Entity name: 7ffff64d060>))
Command: (setq en2 en)
<Entity name: 7ffff64d060>
Command: (entget (setq en (entnext en)))
*Cancel*
Command: (vlax-dump-object (vlax-ename->vla-object en1))
; IAcadBlockAlignmentParameterEntity: IAcadBlockAlignmentParameterEntity Interface
; Property values:
;   AlignmentType = 1
;   Angle = 0.0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000013f932308>
;   BasePoint = (50845.0 13772.0 0.0)
;   ChainActions = 0
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000003db85ae8>
;   EndPoint = (60178.0 13772.0 0.0)
;   EntityTransparency = "ByLayer"
;   Grips = 1
;   Handle (RO) = "37E5"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000003da0f998>
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "Alignment"
;   ObjectID (RO) = 42
;   ObjectID32 (RO) = 42
;   ObjectName (RO) = "AcDbBlockAlignmentParameterEntity"
;   OwnerID (RO) = 43
;   OwnerID32 (RO) = 43
;   PlotStyleName = "ByLayer"
;   ShowProperties = -1
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000003da0fb70>
;   Visible = -1
T
Command: (vlax-dump-object (vlax-ename->vla-object en2))
; IAcadBlockAlignmentGripEntity: IAcadBlockAlignmentGripEntity Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000013f932308>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000003db85ae8>
;   EntityTransparency = "ByLayer"
;   GripType (RO) = "Alignment"
;   Handle (RO) = "37E6"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000003da0fed8>
;   InsertionCycling = -1
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   ObjectID (RO) = 44
;   ObjectID32 (RO) = 44
;   ObjectName (RO) = "AcDbBlockAlignmentGripEntity"
;   OffsetX = 0.0
;   OffsetY = 0.0
;   OwnerID (RO) = 43
;   OwnerID32 (RO) = 43
;   ParameterName (RO) = "Alignment"
;   PlotStyleName = "ByLayer"
;   Position = (50845.0 13772.0 0.0)
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000003d1d98b0>
;   Visible = -1
T
Command: (entdel en1)
<Entity name: 7ffff64d050>
Unfortunately you don't get those if you're not inside BEdit at the time. So are your blocks directly wblocked out? If so ensure they open directly in the BEdit environment. Alternatively insert all of them into one DWG, then run the next (same if your blocks are already inside a DWG):
Code - Auto/Visual Lisp: [Select]
  1. (setq b nil)
  2. (while (setq b (tblnext "BLOCK" (not b)))
  3.   (command "_.BEDIT" (cdr (assoc 2 b)))
  4.   (setq en (entnext))
  5.   (while en
  6.     (setq eo (vlax-ename->vla-object en))
  7.     (if (eq (vla-get-ObjectName eo) "AcDbBlockAlignmentParameterEntity")
  8.       (entdel en))
  9.     (setq en (entnext en)))
  10.   (command "_.BSAVE" "_.BCLOSE"))
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.