Author Topic: Help with my Frankencode  (Read 5720 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Swamp Rat
  • Posts: 502
Re: Help with my Frankencode
« Reply #15 on: June 11, 2010, 04:11:12 PM »
I already tried that selection idea.
I'm just not familiar in the looping part of it. 

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Help with my Frankencode
« Reply #16 on: June 11, 2010, 04:35:23 PM »
well, I don't see where it is selected in that code ... actually there is no selection in the code you have posted. The program iterates through each block in the drawing .. and opens them via DBX .. in which case you wouldn't select anything anyway ... are you talking about the other code or is there something going on I don't know about.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Biscuits

  • Swamp Rat
  • Posts: 502
Re: Help with my Frankencode
« Reply #17 on: June 14, 2010, 08:58:39 AM »
Here's what I tried. Like I said....looping is beyond me.


Code: [Select]
(defun c:2010_Bord2 (/ BlkDwgPath dbxApp oVer bDidError ActDoc BlkCol fromBlkCol selectionset Sel EntData BlkName fromBlkDef BlkDef fromObjList)
 
;updates Border only for all pg2



   (vl-load-com)
    (defun *error* (msg)
   
        (if dbxApp (vlax-release-object dbxApp))
        (setq dbxApp nil)
        (if msg (prompt (strcat "\n Error-> " msg)))
    )
    ;---------------------------------------------
    (setq BlkDwgPath "//Omaw2kfile02/Lozier/Engineering/Eng_Doc/Drafting/BLOCK/TitleBlocks/BTITLE2.dwg")
   
    (setq dbxApp
        (if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
            (vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
            (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
        )
    )
    (setq bDidError (vl-catch-all-error-p (vl-catch-all-apply 'vla-Open (list dbxApp BlkDwgPath))))
    (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    (setq BlkCol (vla-get-Blocks ActDoc))
    (setq fromBlkCol (vla-get-Blocks dbxApp))
    (setvar 'Errno 0)
    (while
        (and
            (not bDidError)
            (not (equal (getvar 'ErrNo) 52))
        )
        (if
            (and
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


        (setq Sel (ssget "x" '((0 . "INSERT") (2 . "2010X-REFBTITLE2"))))

;                (setq Sel (entsel "\n Select block to update: "))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                (setq EntData (entget (car Sel)))
                (= (cdr (assoc 0 EntData)) "INSERT")
                (setq BlkName (cdr (assoc 2 EntData)))
                (not
                    (vl-catch-all-error-p
                        (setq fromBlkDef (vl-catch-all-apply 'vla-Item (list fromBlkCol BlkName)))
                    )
                )
                (setq BlkDef (vla-Item BlkCol BlkName))
            )
            (progn
                (setq fromObjList nil)
                (vlax-for obj BlkDef
                    (vla-Delete obj)
                )
                (vlax-for obj fromBlkDef
                    (setq fromObjList (cons obj fromObjList))
                )
                (vlax-invoke dbxApp 'CopyObjects fromObjList BlkDef)
                (vla-Regen ActDoc acActiveViewport)
                (prompt (strcat "\n Updated block: " BlkName))
            )
        )
    )
    (*error* nil)
    (princ)
)