Ruby: Find the first 7 characters


stevenyhof
 Share

Recommended Posts

Hello,

I am new to CA and Ruby, and I will study Ruby to learn more, but while I am setting up my layout with my title block, I want to use the same plan (file) name set up I had in ADT.

If my file name is called SND1234 John and Sue Doe.plan - I'm sure I need to use the %file.name% name, but in some way tell ruby that I only want the first 7 characters.

So in the layout in the Title Block under File Name will be SND1234 - Removing the John and Sue Doe

Thank you,

Steve

 

Link to comment
Share on other sites

Why would you put your clients names in the file name? I'm sure you've been doing things long enough that you have a file naming format that you like, but for the sake of simplicity maybe it's time to revisit that strategy. This might be a good chatroom topic, to discuss various file naming formats.

Mine:

For Builders:

Companyname20201, Companyname20202, etc.

 

For Individuals:

Lastname2020

 

Easily memorable and searchable.

 

Link to comment
Share on other sites

I have a database with a counter that gives me a number - 1802, 1803, 1804 as I create a new record to store all my clients info and plan info.

I also work for many builders, so they each have their own three digit code and folder - SND, MPI, BMI, etc.

When I create a new plan I save it into the builders folder - MPI1804 

But that does not tell me much about the client, so I add the clients name, or something more...

MPI1804 John and Linda Smith

In ADT, the first 7 characters are auto placed into my title block.

When someone calls me 5 years from now, they can give me the file name - BMI1423 and I know the build and then can easily find the plan number.

I have done this for almost 16 years. Not that I could change, but I will still be using my database(s) and ADT for some time yet before CA takes its place. Either way, I will keep my file management as I have for many years. 

Thank you

See images...

 

folders.jpg

filesnames.jpg

PLAN.jpg

database.jpg

find.jpg

Link to comment
Share on other sites

Hello Ruby Script-er,

I am new to CA and Ruby, and I will study Ruby to learn more, but while I am setting up my layout with my title block, I want to use the same plan (file) name set up I had in ADT.

If my file name is called SND1234 John and Sue Doe.plan - I'm sure I need to use the %file.name% name, but in some way tell ruby that I only want the first 7 characters.

So in the layout in the Title Block under File Name will be SND1234 - Removing the John and Sue Doe

See images above

Thank you,

Steve

tb.jpg

Link to comment
Share on other sites

19 minutes ago, robdyck said:

Perhaps @Alaskan_Son could help you out. I'd send him a PM. He's provided me with some very valuable, time saving macros.

I will reach out to him. I talked to him a few days ago on the phone - really great and smart fellow! Thank you Robert

Link to comment
Share on other sites

Steve,
I'm sure you'll find a way to get done what you're asking, but just throwing this out there...  if once you name a file it's name/code # you use never changes, then you might consider simply copying the job# part of your file name and pasting it into the relevant part of the title block on Page 0 of your plans, where it will automatically populate every page of your plans.

Link to comment
Share on other sites

8 hours ago, stevenyhof said:

Hello Ruby Script-er,

I am new to CA and Ruby, and I will study Ruby to learn more, but while I am setting up my layout with my title block, I want to use the same plan (file) name set up I had in ADT.

If my file name is called SND1234 John and Sue Doe.plan - I'm sure I need to use the %file.name% name, but in some way tell ruby that I only want the first 7 characters.

So in the layout in the Title Block under File Name will be SND1234 - Removing the John and Sue Doe

See images above

Thank you,

Steve

tb.jpg

 

A few quick notes and tips:

1.  %file.name% is a purely Chief Architect text macro and not anything you can access or modify with Ruby.

2.  %file.name% placed in layout gets its information from the Layout file, not from the Plan file.

3.  If really you want to use %file.name%, one thing you can do is use a monospaced font and simply cover the rest of the name with a CAD mask (solid fill set to background color and invisible line style).  Then place the objects in the appropriate Drawing Order.

4.  If it was me, I would be using and modifying (with Ruby) the referenced_filename attribute along with a Layout Box. 

  • Like 1
Link to comment
Share on other sites

Quote

I would be using and modifying (with Ruby) the referenced_filename attribute along with a Layout Box.

 
Thank you Michael! I didn't think of the mask - great idea! I will also look into Ruby a bit more although I am completely lost yet. I may reach out to you for some help. 

PS. I am working my way through the tutorial as you suggested - at the same time messing with my set up

 

Link to comment
Share on other sites

25 minutes ago, Alaskan_Son said:

 

2.  %file.name% gets its information from the Layout file, not from the Plan file.

For this reason, my folder, my plan file and layout file have the exact same name. I distinguish based on the icon or extension. All pdfs I produce from that file share the file name with the addition of a single number indicating the order of issue.

  • Like 1
Link to comment
Share on other sites

6 minutes ago, robdyck said:

For this reason, my folder, my plan file and layout file have the exact same name. I distinguish based on the icon or extension. All pdfs I produce from that file share the file name with the addition of a single number indicating the order of issue.

 

I do much the same thing, however, there are very good reasons for the 2 to get different names such as...

  • When I'm referencing more than one plan file with a single layout (As-Built, Demolition, Proposed, Details, Warehouse plan, etc.)
  • When I'm using more than one layout file for a single plan file (Permit Plans, Cabinet Plans, Tile Details, Window Order, Fabrication Drawings, etc.)
Link to comment
Share on other sites

4 minutes ago, robdyck said:

For this reason, my folder, my plan file and layout file have the exact same name. I distinguish based on the icon or extension. All pdfs I produce from that file share the file name with the addition of a single number indicating the order of issue.

Pretty much my workflow also. Has worked well for about 22 years.

Link to comment
Share on other sites

Quote

 If really you want to use %file.name%, one thing you can do is use a monospaced font and simply cover the rest of the name with a CAD mask (solid fill set to background color and invisible line style).  Then place the objects in the appropriate Drawing Order.

I set up a mono spaced font and added a solid filled white box to cover the remaining file name info. However, I cannot find anything in help or in the forums for drawing order or stacking objects. Even though I made the box last it is under the file name text. Some direction please!

Link to comment
Share on other sites

2 minutes ago, stevenyhof said:

I set up a mono spaced font and added a solid filled white box to cover the remaining file name info. However, I cannot find anything in help or in the forums for drawing order or stacking objects. Even though I made the box last it is under the file name text. Some direction please!

Search "Drawing Group"

  • Like 1
Link to comment
Share on other sites

6 hours ago, stevenyhof said:

The CA help worked and all you guys! Thank you! I was able to blank it out with a box filled and draw two lines over to put my TB back together. It's not as good as coding, but it seems to work fine :)

tb.jpg

 

Nice.  He's another quick freebie tip for ya...

If you want to use the plan file name, simply place the macro in your plan file, a CAD Detail is as good a place as any, send that view to layout, and instead of using a mask, simply crop the layout box.  You can do a similar thing in layout by placing the macro into a CAD Detail there, sending that to Layout (yes...from layout to layout), and then cropping the layout box.

Link to comment
Share on other sites

I folllow what you're saying, but I still dont know where to find the plan file script name - I don't even know how to ask for what I want - LOL - I will keep working on it and learning things - I shouldn't be bugging you guys so soon. I'm not getting the work I should be doing done, so you are most likely not either. I do appreciate everyone's comments and help though!!

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