stevenyhof

Ruby: Find the first 7 characters

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

 

Share this post


Link to post
Share on other sites

Why can’t you name your file anything you want?  I am wondering why you need to use Ruby to name your plan file?

Share this post


Link to post
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.

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Is there any place in a folder's properties to add keywords? I can't find that option but it must exist...

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Might be a good idea to suggest Chief come up with a little bit more robust plan search tool. ie...

 

image.thumb.png.e451bd226b5f214790abd17646e8484e.png

 

image.thumb.png.d613f7f08ad9154f9722c8111b4a83c5.png

Share this post


Link to post
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.)

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Starting your search on the Chief website ...

 

ct1.thumb.png.284b194cd79e5a5e9220468b580e9959.png

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, solver said:

Starting your search on the Chief website ...

 

ct1.thumb.png.284b194cd79e5a5e9220468b580e9959.png

 

Good tip, but I personally always recommend people start in the Help files and then move elsewhere as a second option.

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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!!

Share this post


Link to post
Share on other sites

Maybe send me to a place what I can find the list of macros

Share this post


Link to post
Share on other sites
Just now, stevenyhof said:

Maybe send me to a place what I can find the list of macros

 

This is honestly a small lesson in and of itself. 

Share this post


Link to post
Share on other sites

I'm sure! I am in help and reading now - thank you

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Member Statistics

    28444
    Total Members
    9156
    Most Online
    Lufunoraf
    Newest Member
    Lufunoraf
    Joined