Jump to content
Developer Wiki and Function Reference Links ×

Deleting Workgroup Referenced Layer


PeterT

Recommended Posts

  • 8 months later...

No, I never found a way to do this with Vectorscript, and I never got any response from anyone else.

Currently, I have to exit my script, manually delete the reference, then run a second script to complete my operation.

I suppose I could invoke the "Workgroup Reference" dialog with a "DoMenuTextByName", but I would still have to manually click the "Remove" button.

Thanks for your response though, its better to get a response with more questions than no response at all.

Link to comment

Hi Peter,

I tried DelObject(ActLayer), where the active layer is a WG referenced layer. As you said, it doesn't work. On a whim I tried the same thing, but I moved to another layer before deleting the WGR layer. It was deleted.

You cannot delete the layer if it is Active. Move to another layer then delete to your heart's content. See following script for an example.

HTH,

Raymond

code:

Procedure DelWGR;

{ If the Active Layer is a WGR, delete it. }

VAR

LHnd, TmpLHnd :Handle;

WGRPath :String;

BEGIN

WGRPath := '';

LHnd := ActLayer;

if IsLayerReferenced(LHnd, WGRPath) then begin

TmpLHnd := PrevLayer(LHnd);

if (TmpLHnd = nil) then

TmpLHnd := NextLayer(LHnd);

if (TmpLHnd <> nil) then begin

Layer(GetLName(TmpLHnd)); { move to another layer }

DelObject(LHnd);

message('WGR Layer - ', WGRPath, ' - has been deleted.');

Sysbeep;

end

else message('Cannot delete WGR if it is the only layer in the file.');

end;

END;

Run(DelWGR);
[/code]

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