Jump to content

Layer palette update


casariana

Recommended Posts

Hello everyone,

 

When I create a new layer using

(command "._Layer" "_Make" "layer_name" "_Color" "94" "layer_name" "_LT" "Continuous" "layer_name" "")

Even if I set the new layer as current with

(setvar "clayer" "layer_name")

Although the layer is created, It won't show at the layer palette, unless I close and reopen the drawing or insert an object at the layer.

 

The same happens when I use the Steal code from Lee Mac.

 

I also tried to thaw and turn the layer on using this code I adapted from some forum (sorry I didn't credit the code I based mine, but I cannot find it anymore):

(defun turn_on ( layer / dx en in ss )
  (vl-load-com)
   (if (not (null (setq en (tblobjname "LAYER" layer))))
     (progn
       (if
           (and
               (setq en (entget en)
                     dx (assoc 70 en)
                     en (entmod (subst (cons 70 0) dx en))
               )
               (setq ss (ssget "_X" (list (cons 8 layer))))
           )
	   (progn
             (repeat (setq in (sslength ss))
               (entupd (ssname ss (setq in (1- in))))
             )
       )
	 
       )
       (vla-put-LayerOn (vlax-ename->vla-object (tblobjname "LAYER" layer)) 1)
     )
   )
   (princ)
)

Still, the layer created is not showing in the layer palette list. How could I fix it?

 

Thanks a lot!

Link to comment
Share on other sites

You have sent me a PM which refers to this topic I think. The fact that you have received no answer does not means members have missed it. It may just be a problem that is hard, or impossible, to solve. IMO it is probably a bug in the layer palette list. I use BricsCAD and do not encounter this bug with, what I think is, the equivalent feature: the Layers panel.

Maybe there are commands to close and reopen the palette in AutoCAD that can be used to create a workaround?

Link to comment
Share on other sites

Assuming you're using a Ribbon or Toolbar macro simply add CLAYER layer_name to the end instead of 

(setvar "clayer" "layer_name")

The Ribbon display doesn't update to code as that would slow the code.

Link to comment
Share on other sites

I just tested in AutoCAD 2019 and could not reproduce this? Do you have all service packs installed? What graphics card are you running?

Link to comment
Share on other sites

8 hours ago, Roy_043 said:

You have sent me a PM which refers to this topic I think. The fact that you have received no answer does not means members have missed it. It may just be a problem that is hard, or impossible, to solve. IMO it is probably a bug in the layer palette list. I use BricsCAD and do not encounter this bug with, what I think is, the equivalent feature: the Layers panel.

Maybe there are commands to close and reopen the palette in AutoCAD that can be used to create a workaround?

 

Thank you very much for your answer and sorry to bother you, I got worried I messed it up! 😅

Anyway, I tried to do what you said and  it did not solve my problem, unfortunately.

But I am greatful for your reply!

 

4 hours ago, tombu said:

Assuming you're using a Ribbon or Toolbar

 

Tombu, thank you for your reply but I am not using Ribbon or Toolbar. I was refering to the layer palette, the layer properties manager.

 

3 hours ago, ronjonp said:

I just tested in AutoCAD 2019 and could not reproduce this? Do you have all service packs installed? What graphics card are you running?

 

Hey ronjonp, thank you for your help! I use the student version, so I don't have all the service packs. I have a Intel HD Graphics 520. You say you could not reproduce it so the created layer was displayed at the layer palette? That's intriguing 🤔

 

 

Anyways, what kinda solved my question was to make a block with a matrix of points from all layers. Then I insert and erase the block after creating the layers. This way I garantee that an object of each layer is being inserted.

This doesn't please me, but works.

 

Link to comment
Share on other sites

17 hours ago, tombu said:

Just guessing in your Layer Properties Manager is the Active Filter "All Used Layers"?

Change it to All.

 

Yes! That's it! I feel kind of stupid I didn't see that before.

Thank you very much!

Link to comment
Share on other sites

24 minutes ago, casariana said:

 

Yes! That's it! I feel kind of stupid I didn't see that before.

Thank you very much!

It's always good to hear a puzzle has been solved.  Thanks for letting us know.  

  • Like 1
Link to comment
Share on other sites

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...