Jump to content

Listing layer name in worksheet


Recommended Posts

Hi,

 

I thought there was a "Worksheet" topic previously, but I can't find it so I've ended up here.

 

I want to list the layer name in a worksheet. I want the worksheet cell to show the name of the layer that the worksheet is inserted on ("Worksheet On Drawing").

 

I also want only part of the layer name so I was thinking of something like "=(Right (LayerName, Len (LayerName) - Pos ('-', LayerName)))" (eg. "Layer-1" returns "1")

 

Can this be done?

Link to comment

You are right we have done this a couple of times before, but I don't have time to find the threads this morning.

 

What you want CAN be done, but it will require scripting.

 

Worksheets can only display objects in the drawing space by default. Since a layer is not an object, a worksheet has no way to access that information. Here are a couple of quick ideas. If you need more help ask again and I will see if I can make some time over the weekend or next week.

 

1. To automatically insert the name of the layer the worksheet is placed on will require a worksheet script. I would have to think for a while about how to best get the handle to the worksheet from which you could easily get the Layer.

 

2. Your Length/Pos looks to be on the right track if you only want part of the name.

 

3. You will need to create a script that loops. Start at the first Layer, get the name, do the shortening, store into a worksheet cell. The script will have to be rerun if/when you add or delete layers.

 

4. If you need it to be dynamic, you probably want to use an object instead. Maybe put a locus in a certain class or with a record attached on each layer. Then you can get the Layer name of the objects in a database in such a way as to have it automatically update.  You might still need a worksheet script to do the shortening. I don't have time to test the string handle capabilities of the worksheet functions right now.

 

5. Option 4 is probably your best bet for a dynamic worksheet.

 

6. And as usual, I am going to ask WHAT you are trying to do, not HOW are you trying to do it. We can often provide a better solution to the whole problem rather than to the subset of the problem you are asking about.

 

 

  • Like 1
Link to comment
  • 1 month later...

Thanks Pat, sorry, didn't get the notification by email that you replied. A bit odd.

 

We have our own titleblock on it's own layer @ 1:1 which is visible. This layer has the prefix drawing number 12345 - 1 - 

 

We have another invisible layer (Detail Layer-1) we are using to draw and dimension components (say 1:5). This layer has the suffix 1 to finish the drawing number.

 

We then duplicate the invisible layer (automatically becomes Detail Layer-2) and draw the second component, and so-on. This layer will have suffix 2.

 

We would like something to automatically reflect the layer number to complete the drawings number.

 

However, if I was to write a script then I would not need the worksheet option.

 

On reflection, your idea may be sound.

 

I could write a macro that duplicates the layer and fills in the worksheet. This would alleviate another problem we have when we change the layer scale from one scale down to another. If we use the text "1" at 10pt, then it becomes smaller and requires us to resize the text. Annoying. Worksheet text is independent of the layer scale 😃

 

If you can offer an alternative, I'm all ears.

 

Thanks

Link to comment

If you need the text shortening, then the only option is a script. The worksheet text handling is not strong enough to do what you want. It could be a worksheet script, but then there are issues with distributing the script to multiple people. But that is a different discussion.

 

Another possibility would be to use a Data Tag. You can create a data tag that will return the layer that the tag is on. I have not figured out how to get that data into a worksheet yet.

 

Longer term, I agree with @Nikolay Zhelyazkov that you should consider turning your title block in to a Title Block Border object. It will help out a lot in the long term.

 

You should probably also take a close work at your workflow and determine if using viewports and sheet layers would not be a better solution that your strictly design layer (??? at least that is what I have gotten from your posts) current workflow.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...