Jump to content

Dehatching a locked layer link on a file - HELP!


Recommended Posts

I have been goofing around with scripts.

Can someone send me a script I can add to my menu that will:

Select all layer links, unlock then change all the objects fill attributes to 'none'?

I got so far in a script as to be able to select all (duh.?) and unlock just one layer at a time.. can't seem to find the change attribute tool and the other vexing issue is how to select the next layer link in the file and unlock, change fill to none and so on...

Suggestions and comments welcome.. I don't have a lot of experience to do this but, I am unwilling to delegate out a bunch of mundane work to someone with even less experience.

TIA

John

Link to comment

A Layer Link just displays what is drawn on the on the "parent" layer, so you cannot turn off the fill on the link unless you turn it off on the parent layer. VectorScript will not help you in this.

You could, however, toggle on "Use Layer Colors" while displaying the linked layer, and if the linked layer's foreground fill color was set to white, the hatch would "disappear". Unfortunately, "none" is not a color so you would have to settle for white.

Link to comment
My understanding is that you cannot do that because of the classes of the items on the referenced layer. Why not just change the classes attributes?

Opening up, unlocking and, changing the object attributes is exactly what I wish to do - but really, really fast because there are many, many files and it will take a long, long time open each layer link in each file.

A script is what I am seeking.

Link to comment
A Layer Link just displays what is drawn on the on the "parent" layer, so you cannot turn off the fill on the link unless you turn it off on the parent layer. VectorScript will not help you in this.

You could, however, toggle on "Use Layer Colors" while displaying the linked layer, and if the linked layer's foreground fill color was set to white, the hatch would "disappear". Unfortunately, "none" is not a color so you would have to settle for white.

Removing the fill (none) is the general idea - it is a silly stunt to make an ACAD user happy with exported files...

Link to comment

You cannot change the attributes of a Layer Link, even when unlocked. Have you tried this manually using the attributes palette? Vectorscript can not do anything that you can not do manually in VectorWorks.

The only things you can do with an unlocked Layer Link is move it, rotate it or delete it.

But in the DWG export, you can choose not to export fills, if that will help you.

Link to comment

Assuming you're not talking about Top/Plan drawings, perhaps Convert Copy to Lines on the LL first, then modifying the group? Manually you would have to select, then call the command, then operate on the group.

In VS I believe you would use the DoMenuTextByName procedure to Convert Copy to Lines, then something like:

VAR

ObH, gObHd :HANDLE;

BEGIN

gObHd:=FSACTLAYER;

WHILE gObHd<>NIL DO BEGIN

IF GETTYPE(gObHd)=11 THEN BEGIN

obH:=FINGROUP(gObHd);

WHILE ObH<>NIL DO BEGIN

SetFillBack(ObH,0,0,0);

SetLS(ObH,2);

SetPenFore(ObH,189);

SetLW(ObH, 14);

SetClass(ObH,'None');

obH:=NEXTOBJ(obH);

END;

END;

gObHd:=NEXTSOBJ(gObHd);

ReDraw;

SetPref(10,false);

SetPref(11,false);

END;

END;

To modify the group.

Link to comment
You cannot change the attributes of a Layer Link, even when unlocked. Have you tried this manually using the attributes palette? Vectorscript can not do anything that you can not do manually in VectorWorks.

Of course, I meant you have to find the linked orginal then change its attribut to none, etc..

But in the DWG export, you can choose not to export fills, if that will help you.

The ACAD user has told be that the fills and hatches remain even though I choose not to export or rather, unchecked these boxs in the export dialog window.

Link to comment
Assuming you're not talking about Top/Plan drawings, perhaps Convert Copy to Lines on the LL first, then modifying the group? Manually you would have to select, then call the command, then operate on the group.

In VS I believe you would use the DoMenuTextByName procedure to Convert Copy to Lines, then something like:

VAR

ObH, gObHd :HANDLE;

BEGIN

gObHd:=FSACTLAYER;

WHILE gObHd<>NIL DO BEGIN

IF GETTYPE(gObHd)=11 THEN BEGIN

obH:=FINGROUP(gObHd);

WHILE ObH<>NIL DO BEGIN

SetFillBack(ObH,0,0,0);

SetLS(ObH,2);

SetPenFore(ObH,189);

SetLW(ObH, 14);

SetClass(ObH,'None');

obH:=NEXTOBJ(obH);

END;

END;

gObHd:=NEXTSOBJ(gObHd);

ReDraw;

SetPref(10,false);

SetPref(11,false);

END;

END;

To modify the group.

Line #2: VAR

|

{ Error: Variable declarations must be at the beginning. }

Line #3: ObH, gObHd :HANDLE;

|

{ Error: Identifier not declared. }

|

{ Error: Identifier not declared. }

Line #4: BEGIN

|

{ Error: Did not expect this after end of statement - missing ;? }

Line #5: gObHd:=FSACTLAYER;

|

{ Error: Identifier not declared. }

Line #6: WHILE gObHd<>NIL DO BEGIN

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a Boolean. }

|

{ Error: Expected DO }

Line #7: IF GETTYPE(gObHd)=11 THEN BEGIN

|

{ Error: Identifier not declared. }

Line #8: obH:=FINGROUP(gObHd);

|

{ Error: Identifier not declared. }

|

{ Error: Identifier not declared. }

Line #9: WHILE ObH<>NIL DO BEGIN

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a Boolean. }

|

{ Error: Expected DO }

Line #10: SetFillBack(ObH,0,0,0);

|

{ Error: Identifier not declared. }

Line #11: SetLS(ObH,2);

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a handle. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Error: Expected ) }

|

{ Error: Did not expect this after end of statement - missing ;? }

Line #12: SetPenFore(ObH,189);

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a handle. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Warning: Expected a longint or integer expression. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Warning: Expected a longint or integer expression. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Warning: Expected a longint or integer expression. }

|

{ Error: Expected ) }

|

{ Error: Did not expect this after end of statement - missing ;? }

Line #13: SetLW(ObH, 14);

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a handle. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Error: Expected ) }

|

{ Error: Did not expect this after end of statement - missing ;? }

Line #14: SetClass(ObH,'None');

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a handle. }

|

{ Error: Expected , }

|

{ Error: Expected a string. }

|

{ Error: Expected a string. }

|

{ Error: Expected ) }

|

{ Error: Did not expect this after end of statement - missing ;? }

Line #15: obH:=NEXTOBJ(obH);

|

{ Error: Identifier not declared. }

|

{ Error: Identifier not declared. }

Line #16: END;

|

{ Error: Compile stopped (too many errors). }

Link to comment
Of course, I meant you have to find the linked orginal then change its attribut to none, etc..

John,

As you were trying to unlock the link, I was assuming you were trying to change the attributes of the link itself. You will not have to unlock the link to change the attributes of the objects on the link's parent layer.

Here is a script that I think may do what you want:

PROCEDURE UnfillLink;

VAR
curlayh : HANDLE;

{------------------------------------------}
FUNCTION NoFill (objh: HANDLE) : BOOLEAN;

BEGIN
	SetFPat(Objh,0);
END;
{------------------------------------------}

{------------------------------------------}
PROCEDURE FillToNone (Linkh : HANDLE);

VAR
parlayh : HANDLE;
Parlayn : STRING;

BEGIN
parlayn := GetObjectVariableString(linkh,160);
Layer(parlayn);
ForEachObjectInLayer(NoFill,0,0,0);
END;
{------------------------------------------}

BEGIN {main}
curlayh := ActLayer;
ForEachObject(FillToNone,T = LAYERLINK);	
Layer(GetLName(curlayh));	
End;

RUN (UnfillLink); 

The possible issues with using this though, are that it will unfill all objects on the parent layers of all layer links in your file. It will not work on hatches inside symbols or groups, but could be fixed to do that. I am no expert at this, so you may want to try this on a test file before running it on your original.

Also, after exporting your file, you will need to manually re-fill all the objects on your parent layers.

P.S. Posts like this are usually better placed in the VectorScript section of the message board.

Link to comment

Thank you! I will try this - I didn't see the vectorscript section - I need to learn how to scroll too - Maybe I should ask the admin. to move this topic to that location?

I figure I have 2 hours to get this working before I will be asked to send the whole enchilada to CADforce in india or, somewhere..

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