Can't pass variable to De
In code i have this lineThisDrawing.Layers(Variable1).Delete
When i point mouse on Varibale1 pops out text:
I'm trying to delete this layer PH-15A.. What is wrong here? All good. But you need to delete (or change layer) all entities on this layer include block definitions, block references and multiline styles. 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.. 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? 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").DeleteEnd 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.. 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 Thank you.. I'll take a look..
页:
[1]