Author Topic: ObjectDBX Xref for block  (Read 19707 times)

0 Members and 1 Guest are viewing this topic.

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #30 on: November 01, 2007, 03:55:27 PM »
Im using notepad and I used a find/replace. I even rewrote your code with Vovka's and then rereplaced dbxApp with dbxDoc. Still same error with a parameter not being optional and nils starting at dbxblocks

Is this line in the code correct?

"(vlax-invoke dbxDoc[or dbxAPP] "Open" dwgName)"

when entered into command line it returns nil (dbxDoc or dbxAPP used not both)
« Last Edit: November 01, 2007, 04:05:38 PM by OcCad »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX Xref for block
« Reply #31 on: November 01, 2007, 04:06:58 PM »
Are you trying to open a drawing that someone already has open?  You can't use ODBX if the drawing is open by anyone.  Maybe the open isn't working.  To test type
Code: [Select]
(vla-get-Name dbxApp)
Upon looking at the code I don't think the file is being open since you don't give it a whole path, not even a drawing name.  You are getting the name of the block/xref, not the path to it.  If the name is the same as the file name, then try
Code: [Select]
(vla-Open dbxApp (findfile (strcat dwgName ".dwg")))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #32 on: November 01, 2007, 04:25:15 PM »
I am the only one in the drawings that I am working with and no they are not open.

I thought the same about the full path and Vovka also posted
Code: [Select]
instead of
(setq InsName  (cdr (assoc 2 EntData)))
write
(setq InsName (cdr (assoc 1 (tblsearch "BLOCK"(cdr (assoc 2 EntData))))))

when
Code: [Select]
(vla-get-Name dbxApp) is entered i only get ""

and with
Code: [Select]
(vla-Open dbxApp (findfile (strcat dwgName ".dwg"))) i get "; error: ActiveX Server returned an error: Parameter not optional."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ObjectDBX Xref for block
« Reply #33 on: November 01, 2007, 04:42:04 PM »
Same error with this?
Code: [Select]
(vla-Open dbxApp (findfile (strcat dwgName ".dwg")) :vlax-false)The ".dwg" is not already added is it?
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ObjectDBX Xref for block
« Reply #34 on: November 01, 2007, 04:44:18 PM »
Throwing darts, how about this?
Code: [Select]
(vlax-invoke-method 'open dbxApp (findfile (strcat dwgName ".dwg")))
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.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: ObjectDBX Xref for block
« Reply #35 on: November 01, 2007, 05:10:34 PM »
the whole code:
Code: [Select]
(defun c:xrs ()
  (command "-layer"
   "make"
   "S-ANNO-XREF"
   "color"
   "7"
   ""
   "ltype"
   "continuous"
   ""
   "s"
   ""
   ""
  )
  (INITDIA)
  (command "xattach" pause)
  (setq EntName (entlast))
  (setq EntData (entget EntName))
  (setq InsName (cdr (assoc 1 (tblsearch "BLOCK"(cdr (assoc 2 EntData))))))
  (setq InsScale (cdr (assoc 41 EntData)))
  (setq InsPoint (cdr (assoc 10 EntData)))
  (vl-load-com)
 
  (setq dwgName InsName)   ;create an ObjectDBX Document
  (setq dbxDoc (vla-GetInterfaceObject
(vlax-get-acad-object)
(strcat "ObjectDBX.AxDbDocument." (substr (getvar "acadver") 1 2))
       )
  )
  (vlax-invoke dbxDoc "Open" dwgName)   ;get the desired block
  (setq dbxBlocks (vla-get-blocks dbxDoc))
  (setq dbxBlock (vla-item dbxBlocks "Detail Bdr"))
  (setq dbxEname (vlax-vla-object->ename dbxBlock))
  (setq dbxEntData (entget dbxEname))
  (setq dbxBlockInsert (cdr (assoc 331 dbxEntData)))
  (setq dbxScale (cdr (assoc 41 (entget dbxBlockInsert))))
  (vlax-release-object dbxDoc)
  (setq dbxDoc nil)
  (command "scale" EntName "" InsPoint (/ 1 dbxScale))
  ;;after the insert
  (setq EL (entget (entlast)))
  (prompt (strcat "\nInserted "
  (cdr (assoc 2 EL))
  " at scale "
  (rtos (* 12 (cdr (assoc 41 EL))))
  " = 1' "
  )
  )
  (princ)
)

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #36 on: November 01, 2007, 05:19:24 PM »
"dbxBlockInsert" returns nil.

"(cdr (assoc 331 dbxEntData))" returns nil

And what was it that was stopping me from opening it in ODBX before?
« Last Edit: November 01, 2007, 05:30:39 PM by OcCad »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX Xref for block
« Reply #37 on: November 01, 2007, 05:34:58 PM »
Type '!dbxEntData' at the command line after the code is ran, and post what it returns.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #38 on: November 01, 2007, 05:36:36 PM »
Code: [Select]
((-1 . <Entity name: 78d61380>) (0 . "INSERT") (330 . <Entity name: 7ed8bc40>)
(5 . "5EA8") (100 . "AcDbEntity") (67 . 1) (410 . "TYPICAL STEEL DETAILS") (8 .
"S-ANNO-XREF") (100 . "AcDbBlockReference") (2 . "042200-0101-3") (10 15.3858
6.88422 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44
. 0.0) (45 . 0.0) (210 0.0 0.0 1.0))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX Xref for block
« Reply #39 on: November 01, 2007, 05:39:47 PM »
That isn't the correct block.  Try closing the current drawing, and then run the code again, and post what is returned again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: ObjectDBX Xref for block
« Reply #40 on: November 01, 2007, 05:45:11 PM »
i simulated your conditions: created the dwg with block "Detail Bdr", saved it, created new dwg a ran your program. all went with no errors.

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #41 on: November 01, 2007, 05:47:09 PM »
tw:

Code: [Select]
((-1 . <Entity name: 7d763f18>) (0 . "BLOCK_RECORD") (5 . "63") (102 .
"{ACAD_XDICTIONARY") (360 . <Entity name: 7d763f20>) (102 . "}") (330 . <Entity
name: 7d763c08>) (100 . "AcDbSymbolTableRecord") (100 . "AcDbBlockTableRecord")
(2 . "Detail Bdr") (360 . <Entity name: 7d75a010>) (340 . <Entity name:
0>) (70 . 1) (280 . 1) (281 . 1))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX Xref for block
« Reply #42 on: November 01, 2007, 05:52:01 PM »
That makes it look like the block is not inserted in the drawing any place.  It should look like this.
Code: [Select]
((-1 . <Entity name: 7ed2d0c0>) (0 . "BLOCK_RECORD") (330 . <Entity name:
7ed10c08>) (5 . "C8") (100 . "AcDbSymbolTableRecord") (100 .
"AcDbBlockTableRecord") (2 . "Det-Bub") (360 . <Entity name: 7ed2d0e8>) (340 .
<Entity name: 0>) (102 . "{BLKREFS") [color=red](331 . <Entity name: 7ed2d118>) (331 .
<Entity name: 7ed2d240>) (331 . <Entity name: 7ed2d360>) (331 . <Entity name:
7ed2d380>) (331 . <Entity name: 7ed2d3a0>) (331 . <Entity name: 7ed2d400>) (331
. <Entity name: 7ed2d420>) (331 . <Entity name: 7ed2d440>) (331 . <Entity name:
7ed2d460>) (331 . <Entity name: 7ed2d480>) (331 . <Entity name: 7ed2d4f8>)[/color] (102
. "}"))
Notice all the code 331s.  Those are the inserted block entities.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #43 on: November 01, 2007, 05:52:50 PM »
Vovka: I ran the same test (test detail, test sheet) and it too worked for me. But for some reason when i went to go pull from the detail library it says "; error: bad argument type: lentityp nil"

I xopen the detail from the detail library (read only if that matters) and list the detail bdr and it lists fine...
« Last Edit: November 01, 2007, 05:54:52 PM by OcCad »

OcCad

  • Guest
Re: ObjectDBX Xref for block
« Reply #44 on: November 01, 2007, 06:00:59 PM »
Entire list of Detail Bdr from within detail library

Code: [Select]
                  BLOCK REFERENCE  Layer: "0"
                            Space: Model space
                   Handle = 72bf
       Block Name: "Detail Bdr"
   Anonymous Name: "*U6"
                at point, X=    0'-0"  Y=    0'-0"  Z=    0'-0"
   X scale factor:   16.0000
   Y scale factor:   16.0000
   rotation angle:   0.00
   Z scale factor:   16.0000
         InsUnits: Inches
  Unit conversion:    1.0000
  Scale uniformly: Yes
  Allow exploding: Yes
           Height:     9'-4"
            Width:     9'-4"
       Visibility: Show Detail Bubble

                  ATTRIBUTE  Layer: "S-TEXT"
                            Space: Model space
                   Handle = 72c0
             Style = "Text"
        Annotative: No
             Font file = architxt.shx
             start point, X=1'-5 1/16"  Y=0'-2 3/16"  Z=    0'-0"
            height     0'-2"
             value
               tag REF
          rotation angle   0.00
             width scale factor    0.8500
         obliquing angle  15.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-LITE"
                            Space: Model space
                   Handle = 72c1
             Style = "Text"
        Annotative: No
             Font file = architxt.shx
               end point, X=    8'-3"  Y=0'-3 5/16"  Z=    0'-0"
Press ENTER to continue:
            height     0'-1"
             value MSNR-00_A (16)
               tag FILENAME
          rotation angle   0.00
             width scale factor    1.0000
         obliquing angle  15.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-TEXT"
                            Space: Model space
                   Handle = 72c2
             Style = "Text"
        Annotative: No
             Font file = architxt.shx
            center point, X=4'-10 1/4"  Y=0'-2 3/16"  Z=    0'-0"
            height     0'-2"
             value 3/4" = 1'-0"
               tag SCALE
          rotation angle   0.00
             width scale factor    0.8500
         obliquing angle  15.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-TEXT-TB"
                            Space: Model space
                   Handle = 72c3
             Style = "TEXTTB"
        Annotative: No
             Font file = archisel.shx
            center point, X=4'-10 1/4"  Y=1'-1 15/16"  Z=    0'-0"
            height     0'-4"
             value TYPICAL MASONRY WALL
               tag DETAILTOP
          rotation angle   0.00
             width scale factor    0.8500
         obliquing angle  15.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-TEXT-TB"
                            Space: Model space
Press ENTER to continue:
                   Handle = 72c4
             Style = "TEXTTB"
        Annotative: No
             Font file = archisel.shx
            center point, X=4'-10 1/4"  Y=0'-8 5/16"  Z=    0'-0"
            height     0'-4"
             value CONTROL JOINT
               tag DETAILBOTTOM
          rotation angle   0.00
             width scale factor    0.8500
         obliquing angle  15.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-ANNO-TEXT-TB"
                            Space: Model space
                   Handle = 72c5
             Style = "TEXTTB"
        Annotative: No
             Font file = archisel.shx
            center point, X=1'-0 1/2"  Y=0'-7 11/16"  Z=    0'-0"
            height     0'-2"
             value ?
               tag DETAILNO
          rotation angle   0.00
             width scale factor    1.0000
         obliquing angle   0.00
             flags normal
        generation normal

                  ATTRIBUTE  Layer: "S-TEXT-TB"
                            Space: Model space
                   Handle = 72c6
             Style = "TEXTTB"
        Annotative: No
             Font file = archisel.shx
       fit between point, X=    0'-9"  Y=0'-4 1/2"  Z=    0'-0"
               and point, X=    1'-4"  Y=0'-4 1/2"  Z=    0'-0"
            height     0'-2"
             value S?.??
               tag SHEETNO
          rotation angle   0.00
             width scale factor    1.0748
Press ENTER to continue:
         obliquing angle   0.00
             flags normal
        generation normal

                  END SEQUENCE  Layer: "0"
                            Space: Model space
                   Handle = 72c7