I spent my brain

Discussion in 'AutoCAD' started by John, May 11, 2004.

  1. John

    John Guest

    From last two days I was trying to solve the problem but no luck. As I
    mentioned that I'm new to autolisp in previously post. I know it's easy for
    who is Guru in Autolisp but it's really hard for a new person. Need
    Gold?Hint, Ship of Gold in the Deep Blue Sea.

    I'm trying to take room name "waiting room" and number "101" from room tag
    and put into door tag. The routine work fine but some problem needs to be
    solved. I'm able get room name but not able to get room number because data
    store same (cdr (assoc 1 EL)), please see (setq EL (entget (car EN))).
    Please advice me if there is other way to do it. Thank you for your help


    (defun c:DrInfo (/ EN EL RNA RNU DRO)

    (setvar "CMDECHO" 0)



    (setq EN (entsel "\nSelect Room Tag: ")) ;operator input

    (if EN ; Verfiy entity selction

    (progn

    (setq EL (entget (car EN))) ;verfiy it is a Attribute

    (if (= (cdr (assoc 0 EL)) "AEC_MVBLOCK_REF") ;verfy the Object name

    (setq RNA (cdr (assoc 1 EL)) ;get room name

    RNU (cdr (assoc 1 EL)) ;get room number, why the
    same assoc?

    )

    )

    )

    )

    (setq DRO (entsel "\nSelect Door Tag: "))

    (command "-PropertyDataEdit" "p" "" "HHADROBJECTS:Room Name" RNA "")

    (setq mes(strcat "Updated Door Name to" RNA))

    (prompt mes)

    (princ)

    )




    (setq EL (entget (car EN)))

    ((-1 . <Entity name: 4044d1f8>) (0 . "AEC_MVBLOCK_REF") (330 . <Entity name:

    4041ecf8>) (5 . "BA87") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .

    "A-Flor-Iden") (100 . "AecDbEntity") (102 . "{AEC_SUBOBJECT") (300 .

    "AecImpMvBlockRef") (100 . "AecImpObj") (3 . "") (100 . "AecImpEnt") (171 .
    0)

    (100 . "AecImpGeo") (10 2966.31 770.189 0.0) (15 1.0 0.0 0.0) (16 0.0 1.0
    0.0)

    (210 0.0 0.0 1.0) (360 . <Entity name: 4044d218>) (100 . "AecImpBlockRef")
    (341

    .. <Entity name: 40430c00>) (15 4.5 4.5 4.5) (100 . "AecImpMvBlockRef") (102
    ..

    "{AEC_DISP_REPBLOCK_INSTANCES") (100 . "AecImpObj") (3 . "") (100 .

    "AecImpArray") (90 . 1) (102 . "{AEC_SUBOBJECT") (300 .

    "AecMvBlockViewInstance") (100 . "AecImpObj") (3 . "") (100 .

    "AecMvBlockViewInstance") (341 . <Entity name: 40430b38>) (15 0.0 0.0 0.0)
    (102

    .. "{AEC_ATTRIBUTES") (100 . "AecImpObj") (3 . "") (100 . "AecImpArray") (90
    ..

    3) (102 . "{AEC_SUBOBJECT") (300 . "AecMvBlockAttribute") (100 .
    "AecImpObj")

    (3 . "") (100 . "AecMvBlockAttribute") (305 . "Room name") (340 . <Entity
    name:

    4041ec80>) (172 . 0) (341 . <Entity name: 4041eca0>) (149 . 0.0)
    (10 -7.17516

    1.0 0.0) (40 . 1.33333) (1 . "WAITING ROOM") (50 . 0.0) (41 . 1.0) (51 .
    0.0)

    (342 . <Entity name: 40442250>) (71 . 0) (72 . 1) (11 1.11022e-016 1.0 0.0)

    (210 0.0 0.0 1.0) (73 . 0) (2 . "ROOMOBJECTS:NAME") (70 . 0) (74 . 0) (173 .

    -2) (174 . 0) (343 . <Entity name: 0>) (102 . "AEC_SUBOBJECT}") (102 .

    "{AEC_SUBOBJECT") (300 . "AecMvBlockAttribute") (100 . "AecImpObj") (3 . "")

    (100 . "AecMvBlockAttribute") (305 . "Number") (340 . <Entity name:
    4041ec80>)

    (172 . 0) (341 . <Entity name: 4041eca0>) (149 . 0.0) (10 -1.5 -1.5 0.0) (40
    ..

    1.0) (1 . "101") (50 . 0.0) (41 . 1.29604) (51 . 0.0) (342 . <Entity name:

    40442250>) (71 . 0) (72 . 5) (11 1.5 -1.5 0.0) (210 0.0 0.0 1.0) (73 . 0) (2
    ..

    "ROOMOBJECTS:NUMBER") (70 . 0) (74 . 0) (173 . -2) (174 . 0) (343 . <Entity

    name: 0>) (102 . "AEC_SUBOBJECT}") (102 . "{AEC_SUBOBJECT") (300 .

    "AecMvBlockAttribute") (100 . "AecImpObj") (3 . "") (100 .

    "AecMvBlockAttribute") (305 . "Height") (340 . <Entity name: 4041ec80>) (172
    ..

    0) (341 . <Entity name: 4041eca0>) (149 . 0.0) (10 -0.735081 3.29583 0.0)
    (40 .

    0.5) (1 . "9'-0\"") (50 . 0.0) (41 . 1.0) (51 . 0.0) (342 . <Entity name:

    40442250>) (71 . 0) (72 . 1) (11 -0.0573105 3.29583 0.0) (210 0.0 0.0 1.0)
    (73

    .. 0) (2 . "SPACESTYLES:HEIGHT") (70 . 1) (74 . 0) (173 . -2) (174 . 0) (343
    ..

    <Entity name: 0>) (102 . "AEC_SUBOBJECT}") (102 . "AEC_ATTRIBUTES}") (102 .

    "AEC_SUBOBJECT}") (102 . "AEC_DISP_REPBLOCK_INSTANCES}") (102 .

    "AEC_SUBOBJECT}") (102 . "{AEC_NULLOBJECT}") (100 . "AecDbGeo") (100 .

    "AecDbBlockRef") (100 . "AecDbMvBlockRef"))
     
    John, May 11, 2004
    #1
  2. John

    Paul_M Guest

    also take a look at "nentsel"


     
    Paul_M, May 11, 2004
    #2
  3. John

    Doug Broad Guest

    John,
    Part of the reason for few responses is that you are asking about
    ADT customization. There is a specific newsgroup for that.

    To answer your question, I think the following routine will get the
    info you seek from the MVBlock entity list:

    ;Newsgroup: autodesk.autocad.customiztion
    ;Thread: list of verticies
    ;Date: 7/10/01
    ;Posted by: Bobby Jones
    ;Function(s): cdrs
    ;Author: Michael Puckett
    ;Purpose(s): Return cdr data for a particular key with a list


    ;;;(cdrs 10 (entget (car (entsel "\nSelect a polyline: "))))
    ;;;returns something like this:
    ;;;((259.943 -252.219) (215.0 -21.0386).... (253.406 41.8621) (215.817 112.115))
    ;;;Michal Puckett
    (defun cdrs (key lst / pair rtn)
    (while (setq pair (assoc key lst))
    (setq rtn (cons (cdr pair) rtn)
    lst (cdr (member pair lst))
    )
    )
    (reverse rtn)
    )


    ;Examples for your application
    (cdrs 1 el) -> ("LIVING" "001" "9'-0\"")
    (cdrs 2 el) -> ("ROOMOBJECTS:NAME" "ROOMOBJECTS:NUMBER" "SPACESTYLES:HEIGHT")




    Doug Broad
     
    Doug Broad, May 11, 2004
    #3
  4. John

    Paul_M Guest

    -> (setq EL (entget (car EN))) ;verfiy it is a Attribute ?? It gets the
    entity data
     
    Paul_M, May 11, 2004
    #4
  5. John

    John Guest

    I think Paul_M is right. I'm using ADT "MVBlock Entiy". I will trying and
    let you know weather it work or not. Thank you.

    John
     
    John, May 12, 2004
    #5
  6. John

    John Guest

    Yes, you are right. I'm using ADT "MVBlock Entiy". I will trying and
    let you know weather it work or not. Thank you.
     
    John, May 12, 2004
    #6
  7. John

    John Guest

    I tried it but I'm not able to understand it. Can you please give me some
    more explanation. Thank for your help.
     
    John, May 12, 2004
    #7
  8. John

    Doug Broad Guest

    John,
    What I gave you should return 2 lists that contain just the
    information you need. It is up to you to use that info.
    I would discourage you from trying to "program" this task
    however. Doors have a location property, which is automatic
    and can be accessed as long as space objects have been placed.
    You can put these location properties directly into door tag
    mvblocks designed by you. Some of these blocks are already
    available as project oriented

    That said, to make what I gave you work
    1) Save the program I gave you, written by Michael Puckett,
    to a file (I suggest cdrs.lsp in a directory that is listed in your
    options files.)
    2) Save and load the following program
    (load "cdrs")
    (defun c:test ()
    (cond
    ((null (setq ss (ssget ":s" '((0 . "AEC_MVBLOCK_REF")))))
    (princ "\nNo object selected: "))
    (t
    (setq ei (entget (ssname ss 0)))
    (list
    (cdrs 2 ei)
    (cdrs 1 ei)
    ))))

    3)Select your room tag mvblock that was previously attached
    to a space and which has information filled in and visible with test.
    A list of tag names and values will result.

    If you are a beginner, and if the above is mysterious to you, then
    I would encourage you to avoid trying to customize ADT. Such
    a task would certainly be a waste of your time. ADT has not
    been designed as an open system and there is little helpful documentation
    on it either via ActiveX or via DXF access. Those on the ADT customization
    newsgroup have spent years trying to figure out how to do basic tasks.

    Rob Starz has been successful in customizing it but, it is my impression,
    that that is how he makes his living. The best use of your time would
    be to hire someone like Rob with experience to do these programming
    tasks for you. I'm pretty busy myself right now. If you would like to
    hire my services, then pop me an email.

    Hope that helps. Got to go.
    Regards,
    Doug
     
    Doug Broad, May 12, 2004
    #8
  9. John

    John Guest

    Doug,

    Thank you for your help.

    John

     
    John, May 13, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.