@CodeDing
None of these new blocks use attributes. The user functions are all for data processing and drawing of the shape.
Here's an example of a finished part:

All the parts would either be pultrusions/extrusions with a predefined profile.
Search pulls from the database and defines an number of variables (Height, width, length, profile of shape, ect...) This is where fabdata comes from .
(defun Search ( Drawnum / Result )
(progn
;(
;Retrieve Part data
(princ "Retrieving part data")
(SELQuery(strcat "SELECT PART_ID, SECTION, LENGTH, FORMAT, REV FROM PART WHERE STATUS BETWEEN 0 AND 2 AND NAME = '" Drawnum "';"))
(setq partdata result) ;Search parts list for drawing number to retrieve rows database. Returns a nested list.
(setq PART_ID (nth (vl-position "PART_ID" (car partdata)) (cadr partdata))) ;Convert item from list into manipulable variabler
(setq section (nth (vl-position "SECTION" (car partdata)) (cadr partdata)))
(setq plength (nth (vl-position "LENGTH" (car partdata)) (cadr partdata)))
(setq format (nth (vl-position "FORMAT" (car partdata)) (cadr partdata)))
(setq rev (nth (vl-position "REV" (car partdata)) (cadr partdata)))
(SELQuery(strcat "SELECT NAME, WIDTH, HEIGHT, SYMMETRY FROM SECTION WHERE NAME = '" section "';"))
(setq sectiondata result) ;Search parts list for drawing number to retrieve rows database. Returns a nested list.
(setq section (nth (vl-position "NAME" (car sectiondata)) (cadr sectiondata)))
(setq width (nth (vl-position "WIDTH" (car sectiondata)) (cadr sectiondata)))
(setq height (nth (vl-position "HEIGHT" (car sectiondata)) (cadr sectiondata)))
(setq symmetry (nth (vl-position "SYMMETRY" (car sectiondata)) (cadr sectiondata)))
(setq thickness (distof (substr section (+ (vl-string-position (ascii "x") section 0 T) 2))))
(SELQuery(strcat "SELECT TYPE, FACE, SIDE, LOCATION, OFFSET, PARAMETER_1, PARAMETER_2, PARAMETER_3 FROM FABRICATION WHERE PART_ID = '" (itoa PART_ID) "';"))
(setq fabdata result) ;Search parts list for drawing number to retrieve rows database. Returns a nested list.
;)
;(princ)
);progn
)
Inside of search is SELquery which is just a wrapper for the Adolisp function "ADOLISP_DoSQL".
Fabdata is a nested list of lists showing each fabrication used on the shape, where each nested list is the location and specifications of each fab.
Command: !fabdata
(("HOLE" 1 3 46.875 1.5 0.5625 0.0 0.0) ("HOLE" 1 3 52.5625 1.5 0.5625 0.0 0.0) ("R-CUT" 1 3 54.9375 3.0 -43.4518 0.0 0.0))
DrawPerimeter the variables defined in search and creates the outer boundary of the major and minor face of each part. It then checks the profile to create the correct hidden lines as necessary.
Lastly FabDraw is where the nested lists of fabdata are processed and drawn.
You mentioned VBA, and I looked into it a bit. It appears disabling screen updating could be a solution https://www.automateexcel.com/vba/turn-off-screen-updating/.
Also, after thinking about it, it might almost be easier just to prompt the user to click an available point and have the parts drawn up and removed there. That could avoid stepping through the bedit, but might cause issues related to trimming. I'm thinking Ill give that a shot and see where it gets me.
@SORONW ,
Thank you for the snippet. Do any of your new blocks use attributes? There are a handful of user-defined functions in your snippet that I am curious what they accomplish.
@SORONW wrote:
(defun C:FabUpdate (/ BlkList )
(vl-load-com)
(setq blklist nil)
;test connection
(if (connect) (progn (princ "\n\n Connection Error: Please Reload ADOLISP_LIBRARY.lsp & FAB.lsp") (quit) ))
;Get List of all Defined Block in the Document...
(setq BlockTable (vla-get-blocks (vla-get-activedocument (vlax-get-Acad-Object))))
(vlax-for each BlockTable
(setq BlkList (cons (vla-get-Name each) BlkList))
(setq BlkList (cons (vla-get-Comments each) BlkList))
)
;(if BlkList
; (reverse BlkList) ;<-- this is not being stored as a variable,
;) ; therefore, this 'if' statement can be removed entirely.
;Main Loop
(foreach item BlkList
(progn (cond ((vl-string-search "MAJOR" item )
(setq dwg (vl-String-right-trim " MAJOR" item ))
(command "_.-bedit" item "" )
(setq ss (ssget "_A" ))
(repeat (setq i (sslength ss))
(entdel (ssname ss (setq i (1- i))))
)
(search dwg) ;<-- what does this 'search' for?
(drawPerimeter (list 0 0 0) 1 section) ;<-- what are you drawing, and where was 'section' defined?
(setq fabdata (cdr fabdata)) ;<-- where was 'fabdata' defined? and what is it?
(fabDraw fabdata (list 0 0 0) 1) ;<-- what does 'fabDraw' actually draw?
(command "_.-bedit" "S" item "" )
(command "_.bclose" "_sav")
(princ "\nMajor Face Successful!")
)
((vl-string-search "MINOR" item )
(setq dwg (vl-String-right-trim " MINOR" item))
(command "-bedit" item "" )
(setq ss (ssget "_A" ))
(repeat (setq i (sslength ss))
(entdel (ssname ss (setq i (1- i))))
)
(search dwg)
(drawPerimeter (list 0 0 0) 2 section)
(setq fabdata (cdr fabdata))
(fabDraw fabdata (list 0 0 0) 2)
(command "-bedit" "S" item "" )
(command "_.bclose" "_sav")
)
)
)
)
(alert "\nAll Blocks Current")
(princ)
);defun