Jump to content

Recommended Posts

Posted

In code i have this line

ThisDrawing.Layers(Variable1).Delete

When i point mouse on Varibale1 pops out text:

Variable1 = "PH-15A"

I'm trying to delete this layer PH-15A.. What is wrong here?

Posted

All good. But you need to delete (or change layer) all entities on this layer include block definitions, block references and multiline styles.

Posted

There was objects in this layer.. but i have deleted them..

When i make an empty layer Layer1 and in the code change the line to

ThisDrawing.Layers("Layer1").Delete

then it is deleted, but when i change to the other layer, where objects was, then error apears

Is there a way i can tell the code to delete layer anyway?

 

EDIT: I'm still testing, i guess i didn't delete all..

Posted

I have two dvb files under DOCS, and I have opened Visual Basic window but cant find icon where to open these files where new code is?

Posted

I really don't understand. By help of other member i have this code

 Sub LayDel() 'Uses The GetLispSym Function
 Dim Variable1 As String
 'Variable1 = GetLispSym("LAYDEL-NAME") 'At the command line, set your variable (setq LAYDEL-NAME "Layer1")
 ThisDrawing.Layers("Layer1").Delete
End Sub

 

After command "solprof" I have these layer PH-.. and PV-..

I cant delete them even everything is deleted. Even after ctr+A and DELETE..

  • 2 months later...
Posted

Since the layers won't can't be deleted you can use the layer merge command to move them over to the new layer. That would effectively "delete" the layers from the drawings ... I used the layer merge in the following manner:

 

'Create New Viewport

strMView = "mview" & vbLf & "f" & vbLf

ThisDrawing.SendCommand strMView

 

'Use AutoLISP to pass value to VBA (Viewport Name)

strVPLisp = "(setvar " + Chr$(34) + "USERS1" + Chr$(34) + " (cdr (assoc 5 (entget (entlast)))))" + vbCr

ThisDrawing.SendCommand strVPLisp

strVPName = ThisDrawing.GetVariable("USERS1")

 

'Set Name of Layer to be merged

strVPHidden = "PH-" & strVPName

strLayerMergeH = "-laymrg" & vbLf & "n" & vbLf & strVPHidden & vbLf & vbLf & "n" & vbLf & "MergedToLayerName" & vbLf & "y" & vbLf

 

'Merge layer

ThisDrawing.SendCommand strLayerMergeH

 

** I want to make sure everyone knows that I typically program in lisp and, this piece of code was just recently modified from something I made while I was in school in 2002. I haven't programmed in VBA since that time, prior to the recent modification, and I'm sure that some of the commands could be done without using the "SendCommand" feature.

 

I believe I cherry picked all the code and for what it's worth I hope that this might give you some ideas on how to fix your issue.

 

Rob

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...