Author Topic: AutoCAD Architecture objects and Lisp  (Read 3816 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
AutoCAD Architecture objects and Lisp
« on: October 21, 2015, 09:00:04 AM »
Hi everyone,
I have to do work for a client who uses AutoCAD Architecture.
The work is quite simple: count the blocks in the drawing.

For objects INSERT I have no problem, as identification code can use the name of the block.
But in these drawings I must also count "AEC_MVBLOCK_REF" and "AEC_WALL"  :cry:

With the following code I see all the characteristics of these objects:
Code: [Select]
(defun c:propogg (/ obj vlaobj)
  (vl-load-com)
  (setq obj (car (entsel)))
  (setq vlaobj (vlax-ename->vla-object obj))
  (vlax-dump-object vlaobj T)
)

However I can see them only with AutoCAD Architecture, while with AutoCAD Full / BricsCAD I can see only the generic characteristics.

There is some way to get more information (eg, stylename for objects AEC_MVBLOCK_REF, using AutoCAD Full (no Architecture) and/or BricsCAD?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: AutoCAD Architecture objects and Lisp
« Reply #1 on: October 21, 2015, 09:01:48 AM »
Perhaps there is xdata on the objects you could use?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: AutoCAD Architecture objects and Lisp
« Reply #2 on: October 21, 2015, 09:07:00 AM »
What does this program return for the object?

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #3 on: October 21, 2015, 10:14:02 AM »
What does this program return for the object?

Here is the result:


Comando: EE
Selezionare oggetto:
  (
    (-1 . <Nome entità: 7ff6b182a950>)
    (0 . "AEC_MVBLOCK_REF")
    (330 . <Nome entità: 7ff6b18069f0>)
    (5 . "23ABD")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "A780G")
  )
Comando:
Comando: *Annullato*
Comando: *Annullato*
Comando: EEX
Selezionare oggetto:
  (
    (-1 . <Nome entità: 7ff6b182a950>)
    (0 . "AEC_MVBLOCK_REF")
    (330 . <Nome entità: 7ff6b18069f0>)
    (5 . "23ABD")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "A780G")
  )

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: AutoCAD Architecture objects and Lisp
« Reply #4 on: October 21, 2015, 10:16:44 AM »
Can you post a dwg?

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #5 on: October 21, 2015, 10:18:49 AM »
Perhaps there is xdata on the objects you could use?

How do I know?

I can use the following function:
Code: [Select]
(defun soloXdata (ent nameapp / elist exlist)
    (setq elist (entget ent (list nameapp)))
    (setq exlist (assoc -3 elist))
)

but what needs to put in place of "nameapp"?

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #6 on: October 21, 2015, 10:21:26 AM »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: AutoCAD Architecture objects and Lisp
« Reply #7 on: October 21, 2015, 10:21:50 AM »
Lee's code already takes care of that:
Code - Auto/Visual Lisp: [Select]
  1. (entget entity '("*"))

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #8 on: October 21, 2015, 10:26:52 AM »
Lee's code already takes care of that:
Code - Auto/Visual Lisp: [Select]
  1. (entget entity '("*"))


(entget (car (entsel)) '("*"))
Selezionare oggetto: ((-1 . <Nome entità: 7ff6b19256c0>) (0 . "AEC_MVBLOCK_REF") (330 . <Nome entità: 7ff6b19069f0>) (5 . "23AC4") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "A787G"))

 :cry:

ronjonp

  • Needs a day job
  • Posts: 7529
Re: AutoCAD Architecture objects and Lisp
« Reply #9 on: October 21, 2015, 10:43:48 AM »
This might help:
Code - Auto/Visual Lisp: [Select]
  1. (dictsearch (namedobjdict) "AEC_MVBLOCK_DEFS")

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #10 on: October 21, 2015, 10:54:40 AM »
This might help:
Code - Auto/Visual Lisp: [Select]
  1. (dictsearch (namedobjdict) "AEC_MVBLOCK_DEFS")

Ok, here's some more information, and I can see the name of the blocks stored in the entity

Code: [Select]
(
  (-1 . <Nome entità: 7ff6b190f860>)
  (0 . "DICTIONARY")
  (5 . "DF1E")
  (102 . "{ACAD_REACTORS")
      (330 . <Nome entità: 7ff6b19068c0>)
  (102 . "}")
  (330 . <Nome entità: 7ff6b19068c0>)
  (100 . "AcDbDictionary")
  (280 . 0)
  (281 . 1)
  (3 . "M_DFURN_PLANT_3D Plant - A")
  (350 . <Nome entità: 7ff6b19251e0>)
  (3 . "M_KIT_APPL_Refrigerator Unit")
  (350 . <Nome entità: 7ff6b19245e0>)
  (3 . "M_OFURN_CHR_3D Secretary Chair")
  (350 . <Nome entità: 7ff6b19230c0>)
  (3 . "M_OFURN_CONF_3D Conference Table")
  (350 . <Nome entità: 7ff6b19242c0>)
  (3 . "M_OFURN_OFF_3D Computer")
  (350 . <Nome entità: 7ff6b19234e0>)
  (3 . "M_OFURN_OFF_3D Typewriter")
  (350 . <Nome entità: 7ff6b1923c70>)
)

However I can not use that information to figure out how many chairs and how many plants there are in the DWG file.

I have to count how many multi-view blocks (AEC_MVBLOCK_REF) there are, considering blocking visible (chair or plant or whatever).

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: AutoCAD Architecture objects and Lisp
« Reply #11 on: October 23, 2015, 11:38:17 AM »
You can see more info with List command but...
Code: [Select]
Comando:  LISTA
Selezionare oggetti: trovato(i) 1
Selezionare oggetti:
                  AEC_MVBLOCK_REF  Layer: "A780G"
                            Spazio: Spazio modello
                     Gestore = 23abd

       Inserimento : (12701.5535, -3687.1252, 46)
         Rotazione : 181
           Normale : (0, 0, 1)
       Annotazione : No
             Scala :
                 X = 400
                 Y = 450
                 Z = 440
Riferimento blocco : M_OFURN_CHR_3D Secretary Chair (Office Furniture: Chairs: 3D Secretary chair)

Lupo76

  • Bull Frog
  • Posts: 343
Re: AutoCAD Architecture objects and Lisp
« Reply #12 on: October 24, 2015, 02:31:33 AM »
You can see more info with List command but...

Yes, I have seen.
But how can I derive this information with lisp?

Code: [Select]
reference block : M_OFURN_CHR_3D Secretary Chair (Office Furniture: Chairs: 3D Secretary chair)

and the derivation of these?

Code: [Select]
Wall style : Pannello 300 Bifacciale (Standard)
Base height : 3000
Fixed width : 40
Length : 1000