code access to mechanical parameters
I would like to automate the setup of mechanical assembly drawings, using the parameters in the mechanical browser. I understand you can't access mouse clicks with scripting, but is there a way with lisp or other to access these parameters?
cheers
Comments
-
There is .Net API for access to this parameters. I used it for my AVC Property Palitte and AVC DataTable plugins. It work fine0
-
Hi Alexandr, here is my day dream:
-Make a spreadsheet with rows of cabinets and columns with their required parameters
-Use a script (from Scriptsheets maybe?) to select from the existing library of cabinets, change parameters as per the spreadsheet (Height,Width,Depth,Thickness etc), then save each with a new name (again from the spreadsheet)
-Ideally this would run in the background as I'm trying to minimize my drawing time. I could let it sit while I do email or some such. Maybe it could run as Bricscad.exe /automation - just speculating here as I am no coder. I just know that I have to speed things up substantially.
-Then I just insert each cabinet into the main drawing without having to do any adjustment.
thanks for any input..
Scott0 -
Oh, Scott, I suddenly realized that it was your cabinets that gave me so many opportunities to experiment in BricsCAD Mechanical )
However, I do not understand where you want to buy time. Entering cabinet dimensions in Excel or directly into block parameters - isn't it equally long? Probably I could make such a program, just rewrite the data from an external file into BricsCAD parameters... Or even create a separate input form for the parameter table... but does it make sense?0 -
It makes sense for me because the redraws can be very slow when changing params in Bricscad. If I could give it a big list of instructions for multiple cabinets, and go do something else I would save a lot of time vs sitting there waiting for each one. My question would be would it work or would it jam up with too may quick changes? I'm used to patiently waiting for one change to redraw before starting another...would it do the redraws one at a time or would it work in the background then do them all at once at the end?
If it is possible, a spreadsheet or table format would be ideal I think.0 -
I have not obscured that the performance of BriсsСad is so low. I thought the update could happen instantly if you call the Regen command. I need to experiment a little more ...
0 -
Height and depth are pretty quick, but changing width is slow, possibly because there are drawers inside (inserted blocks with features) which need to change width at the same time. Also, upper cabinets with lots of shelf holes (features in the BC_SUBTRACT layer) seem to take a while.
0 -
You can use Lisp for this purpose.
To get parameter values the
(bmlispget)
function is available. The function has a built-in help option:(BmLispGet "?")
. The info for this function in the LDSP is out of date.To 'put' parameter values you can then use the
_-BmParameters
command.It is also possible to edit parameters while inserting components if you use the
_-BmInsert
command.0 -
Thanks Roy, Alexandr - to clarify further, here is a link that shows what I'm after. It's from the developer of Scriptsheets showing a spreadsheet of parameters pulled in by a custom script. In my case I would want each row to be a separate cabinet, and would want each to be saved with a name specified in the row of parameters. (Cab1 for ex)
I don't know how to code myself so would be needing to consult with someone. Just feeling it out whether it's possible / realistic at this point?
https://www.youtube.com/watch?v=OouwUen0J6Ua shot of a cabinet with parameters
0 -
This is of course possible, but requires programming.
I would suggest that you try to fix the poor performance problem first. Most likely, your design parameters can be optimized. It might be worth explode the assembly and causing auto-parameterisation. Maybe there is a way to think over the system of parameters so that there are no chains like: Paramert A is calculated based on the parameter B, and the one from C, from D, and so on. If all calculations are made on the basis of three main parameters without intermediaries, then the entire structure should be recalculated instantly.
If, after all, there are long calculations, I advise you to turn to technical support. It is not normal to wait for such a simple rectangular product to be calculated. How then to design a tractor or an airplane? In any case, It is necessary to draw the attention of developers to this problem.0 -
Interesting - I understand what you mean by chains. I'll give it some thought - there is some instability in some of the cabinets that I haven't been able to pinpoint but maybe that is it. For ex, the drawer component has a width parameter "iw" for inside width of cabinet. It is based on "X", the outside width of cabinet, minus 2x the side thickness. So the drawer width parameter is calculated based on the cabinet width parameter which makes a chain. I could use X-t-t for the drawer width I suppose. I can experiment to see if things speed up, and will ask tech support for their input as well.
Parametrize tends to give some strange, non - intuitive parameters (although optimized I'm sure) for assemblies so I don't tend to use it.Having said all this, if I'm able to optimize the parameters, I would still like to have a spreadsheet based option to create boxes. It helps me identify whether parameters that should be the same are in fact the same. (material thickness for ex) I can just look quickly down the column of numbers vs opening up 10 drawings to check.
Thanks, I'll make updates here as I learn more.
cheers..
Scott0 -
Scott, I got an idea. Why did you stop at the level of a separate cabinet? But what if you make a super-assembly of the whole room. And set the parameters for the room. Including the number of cabinets and the dimensions of each. It will turn out just such a table as you dream. And you will be able to set all the parameters of the room and go for tea while the calculation of all the cabinets is going on
0 -
I like it - you expanded on my day dream! I think baby steps first to test out including your idea of optimizing the parameters, then a cabinet and if all is good - the whole house ;-)
0 -
Basic functionality / proof of concept:
Lisp:
; (ReadCsv "D:/MyComp/BmInsertData.csv") ; Very basic function. (defun ReadCsv (fnm) (mapcar '(lambda (str) (mapcar 'read (vle-string-split "," str))) (cdr (vle-file->list fnm "")) ; Cdr to skip headers. ) ) (defun c:BmInsertData ( / compPath csvDat curX) (setq compPath "D:/MyComp/") (setq csvDat (ReadCsv "D:/MyComp/BmInsertData.csv")) (setq curX 0.0) (setvar 'cmdecho 0) (foreach record csvDat (command "_.-bminsert" (strcat compPath (car record) ".dwg") "_edit" "W" (cadr record) "H" (caddr record) "" "_non" ; Avoid esnap (list curX 0.0 0.0) ) (setq curX (+ curX (cadr record))) ; Add W. ) (command "_.zoom" "_extents") (command "_.zoom" "0.9x") (setvar 'cmdecho 1) )
BmInsertData.csv:
comp,W,H "Window_1x1",800,900 "Window_1x2",1000,900 "Window_1x3",1200,900
0 -
Thanks Roy, I'll work with this and see how it goes.
cheers0 -
So I have a solution for this with help from E.J.Oskam of Scriptsheets. I leaned toward this method vs lisp or programming because it's something I can almost get my head around and modify/update myself with the right tools. I have a simple spreadsheet with rows of cabinets, and the script creates them in seconds so I can continue with the actual job of building kitchens etc. My next step is to optimize the my cabinets for speed, and to build a proper library.
cheers all0