Dru Starook Posted October 20, 2022 Posted October 20, 2022 Hello all, I have a LISP for adding revisions to a title block that I need help with making work in BricsCAD. I was able to modify the LISP and have it work with one exception. I can't seem to get the Attribute editor to select the "REVISION" block. It instead, it wants to edit the "TITLE BLOCK". AutoCAD LISP: ;insert TitleBlock revision (defun C:REV(/ L OS PT SS TB) ;(rtzstr) (setq OS (getvar "OSMODE") L (getvar "CLAYER"));get current layer & snap settings (if (= (getvar "CTAB") "Model");get to a tab & into paper space (progn (command "-layout" "s" "") (command "pspace") ) (command "pspace") ) (command "zoom" "w" "15.125,7.1875" "16.625,2.4375");zoom to revision area (setvar "CLAYER" "0") (setvar "OSMODE" 32) (setq PT (getpoint "\nREVISION\nSelect Row Insert Point:")) (setvar "OSMODE" 0) (command "-insert" "REVISION" "s" "1" PT "0" (DATE?));insert revision block & call DATE? function (setq SS (ssget "L")) (initdia)(command "attedit" "l") (command "zoom" "extents");(zoom so titleblock can be sent to refedit) (command "-refedit" "0.125,0.125" "O" "A" "N") (command "refset" "a" (ssname SS 0) "");add revision block to titleblock reference (command "refclose" "s") (command "zoom" "previous") (setvar "OSMODE" OS) (setvar "CLAYER" L) ;(rtzexit) ;check for goofy linetype (if (tblsearch "LTYPE" "{ Half Dash }") (alert "Goofy Linetype detected.\nPlease see Brian") ) (princ) ) BricsCAD LISP: ;insert TitleBlock revision (defun C:REV(/ L OS PT SS TB) ;(rtzstr) (setq OS (getvar "OSMODE") L (getvar "CLAYER"));get current layer & snap settings (if (= (getvar "CTAB") "Model");get to a tab & into paper space (progn (command "layout" "s" "") (command "pspace") ) (command "pspace") ) (command "zoom" "w" "15.125,7.1875" "16.625,2.4375");zoom to revision area (setvar "CLAYER" "0") (setvar "OSMODE" 32) (setq PT (getpoint "\nREVISION\nSelect Row Insert Point:")) (setvar "OSMODE" 0) (command "-insert" "REVISION" "s" "1" PT "0" (DATE?));insert revision block & call DATE? function (setq SS (ssget "L")) (initdia)(command "eattedit" "1") (command "zoom" "extents");(zoom so titleblock can be sent to refedit) (command "-refedit" "0.125,0.125" "O" "A" "N") (command "refset" "a" (ssname SS 0) "");add revision block to titleblock reference (command "refclose" "s") (command "zoom" "previous") (setvar "OSMODE" OS) (setvar "CLAYER" L) ;(rtzexit) ;check for goofy linetype (if (tblsearch "LTYPE" "{ Half Dash }") (alert "Goofy Linetype detected.\nPlease see Brian") ) (princ) ) Thank you for your time. Dru Quote
BIGAL Posted October 20, 2022 Posted October 20, 2022 Why is your revision not part of your title block have always done it that way. Also when you insert can add the attribute value then. When revs are full I have move revs up.lsp Quote
Dru Starook Posted November 3, 2022 Author Posted November 3, 2022 Thanks for the reply BAGAL. I inherited the job of maintaining our CAD systems and did not write the routine. I am not proficient in writing LISP routines. Not sure why the person who wrote it did in the way they did. Probably like everything else in CAD, there are a thousand different ways to do the same thing. I'm just trying to get things to work in BricsCAD. Having said that. I will try to clarify the problem I am having. AutoCAD opens the block editor, opens the "Edit Attribute" to be filled out, inserts the attribute into the TITLEBLOCK block, then saves and closes the block editor. BricsCAD opens the block editor, but then the “Attribute Editor” is trying to open the TITLEBLOCK block. Hopefully this explains it a little better. Quote
BIGAL Posted November 3, 2022 Posted November 3, 2022 (edited) Just use BEDIT and choose title block, then can do Attedit adding revisions to original title block. Do Bclose and save, if you have existing title block do ATTSYNC, this will update the title block and make the revisions exposed. I suggest you set the default to say "-" for one of the items in the revision so you can dbl click it and the edit dcl will open. Add as many rows as you need at time of Bedit, the image above has 7 revisions with only the 1st exposed, but the others are there. Edited November 3, 2022 by BIGAL Quote
Dru Starook Posted February 14, 2023 Author Posted February 14, 2023 I have been experimenting with adding the attributes to the title block. Does the above example have different attribute names for each revision? If not how does the program distinguish between rev A and rev B? My other problem is the title block resides on multiple tabs in paper space. I have not found a way in BricsCAD to edit all attributes across multiple layouts/blocks. I know AutoCad has GATTE command, but I can not find a BricsCAD equivalent. Is anyone aware of a BricsCAD equivalent? Quote
BIGAL Posted February 14, 2023 Posted February 14, 2023 (edited) This allows you to update one title block in a layout then it will copy all attribute details to the other title blocks in all layouts. A simpler version would be to pick one attribute and do the same thing across all layouts. A seperate "sheet x of Y" lisp is used for that function. YES works in Bricscad. ; simple update block attribute across all layouts ; By Alan H Nov 2020 (defun c:attall ( / tabs lst x y attnum tabname att bname ATTS BLK SS) (setq tabs (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))) (setq blk (vlax-ename->vla-object (car (entsel "\nPick title block ")))) (setq atts (vlax-invoke blk 'getattributes)) (setq lst '()) (foreach att atts (setq lst (cons (vla-get-textstring att) lst)) ) (setq lst (reverse lst)) (setq bname (vla-get-name blk)) (vlax-for lay tabs (setq x (vla-get-taborder lay)) (setq tabname (vla-get-name lay)) (if (/= tabname "Model") (progn (setq attnum -1) (setvar "ctab" tabname) (IF (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 410 tabname)(cons 2 bname)))) (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS 0 )) 'getattributes) (vla-put-textstring att (nth (setq attnum (1+ attnum)) lst)) ) ) ) ) ) (princ) ) (c:attall) Used in conjucntion with auto layout creation. Edited February 14, 2023 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.