PeterT Posted March 10, 2005 Share Posted March 10, 2005 Is there any way to delete a workgroup referenced layer in a script? "DelObject(LayerHandle);" does not seem to work on referenced layers. I would also settle for removing the entire reference itself, but I cannot find any way to do that either. Quote Link to comment
shorter Posted November 29, 2005 Share Posted November 29, 2005 Dear PeterT Did you ever get a response to your question? I was hoping to find a way to remove the link but keep the referenced layer in the file. Regards Steven Shorter Quote Link to comment
PeterT Posted November 30, 2005 Author Share Posted November 30, 2005 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. Quote Link to comment
MullinRJ Posted December 1, 2005 Share Posted December 1, 2005 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] Quote Link to comment
Recommended Posts
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.