Recommended Posts

He all,

 

After 8 years of being a CA user, here is my first contribution (my effort to start to give back for all the great advice/knowledge in these forums).

 

I have been working on automating my kitchen and bath designs with a schedule that lists all the cabinets and components that are worth noting (doors/drawers/mouldings/appliances). To that end I have created two macros that I use in my templated cabinet defaults. (I created a custom object field named Components and added the macro to the Field Value as will as changing the description field value with the other.) The Macro files are attached and free to use as you like:-).

 

The macros are cabinetDescription:

 

nf = NumberFormatter.new

nf.unit = 'in'

nf.use_fractions = true

nf.denominator = 32

nf.show_unit = false

owner.type + "\n" + "Width: " + + nf.apply(owner.width).to_s + "\"\n" + "Height: " + + nf.apply(owner.height).to_s + "\"\n" + "Depth:" + nf.apply(owner.depth).to_s + "\""

 

and CompDrwDrs:

 

nf = NumberFormatter.new

nf.unit = 'in'

nf.use_fractions = true

nf.denominator = 32

nf.show_unit = false

components = ""

col = owner.front_side.items

if col.count > 0

for i in 0 .. (col.count-1)

if (col[i].is_drawer == true or col[i].is_door == true or col[i].type == "Opening" or col[i].type == "Appliance")

components += (col[i].type + ": " + nf.apply(col[i].width) + "\"W x " + nf.apply(col[i].height) + "\"H\n")

end

end

end

mol = owner.moldings

if mol.count > 0

for j in 0 .. (mol.count -1)

components +=("Moulding: " + nf.apply(mol[j].height) + "\"W x " + nf.apply(mol[j].width) + "\"T \n")

end

end

components

 

Enjoy and hope these help.

Michael

CA 15

 

Below is the resulting custom Cabinet Detail Schedule:

image.thumb.png.167b8ff6da4b6e36e47e4dc3235f464d.png 

cabinetComponents.json cabinetDescription.json

  • Like 2
Link to comment
Share on other sites

Nice work. Might want to turn off leading 0’s in number for matter for your moldings.

also be nice to set conditions for designating a sink base and m/w etc.If you want an additional challenge, you could script in splitting your double doors to report their actual size. Macros are fun :)

thanks for sharing 

Link to comment
Share on other sites

Thanks Rene! Yeah its a bit rough (formatting of code and output:-). And really appreciate your videos as well as your guidance in these forums. I scoured through yours and Joe's posts to gather what little knowledge I have gained about Ruby macros in CA. I am a career programmer (Java, Python and C++) and found the lack of info on CA Macros so frustrating. Makes me want to put together a guide book on what can be done. There is so much potential for automation in our drawings, its surprising CA doesn't prioritize exposing these capabilities more (programmatically and documentation wise).

 

Again, many thanks for all your contributions in these forums and on YouTube!

Link to comment
Share on other sites

1 hour ago, mthomas512 said:

Thanks Rene! Yeah its a bit rough (formatting of code and output:-). And really appreciate your videos as well as your guidance in these forums. I scoured through yours and Joe's posts to gather what little knowledge I have gained about Ruby macros in CA. I am a career programmer (Java, Python and C++) and found the lack of info on CA Macros so frustrating. Makes me want to put together a guide book on what can be done. There is so much potential for automation in our drawings, its surprising CA doesn't prioritize exposing these capabilities more (programmatically and documentation wise).

 

Again, many thanks for all your contributions in these forums and on YouTube!

Only reason I started learning is because only a few macro users share any info and some of them will be(should be) retiring soon :)
I've got a really complex macro for cabinets that follows formatting for industry standards on modular cabinets. I wont give too much away on it but it is split up into 3 macros, one for each cabinet type. It looks for all kinds of parameters such as num drawers, doors, full height doors, fixtures, conditional depth reporting, opening sizes, and even pricing.
Nice to split them up because they get more and more complex over time
Also thanks for the mention..feel free to ask macro questions, it helps everyone out and brings some users out that lurk but really know their stuff

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share