Jump to content
WhoCanDo

Attribute Criteria PP= is not working

Recommended Posts

Posted (edited)

Hi,

 

Can anyone explain why this is not working please? I want to use PP= with ForEachObject, but the test below indicates that (PP = Line_Style) doesn't work when the Line_Style is changed to a "Line Type" (Dotted, etc.)

 

procedure test;
var Line_Index : longint;
begin
ClrMessage;
Line_Index := GetLSN (FSActLayer);
Message (Line_Index); Wait (2);
DSelectAll;
SelectObj ((PP = Line_Index));
Message (GetLSN (FSActLayer), '  ', Line_Index);

{

ForEachObject (Do_This, ((T = Line) & (PP = Line_Index)));

}
end;
run (test);

Edited by WhoCanDo
added - when the Line_Style is changed to a "Line Type" (Dotted, etc.)

Share this post


Link to post

PP is for pen pattern. What you want is LT, which takes the name of the line style. Using the criteria can be useful to get the syntax correct.

 

Criteria can also be finicky with variables. You often need to pass the entire criteria as a string with escaped quotation marks around any string values.

 

e.g.: 

crit := Concat('((T = Line) & (PP = ''', Line_Index, ''')))');

FEO( Do_This, crit);

 

You can also concat Chr({ADCII_CODE_FOR_SINGLE_QUOTE}) instead of using the 'x3, but I don't have that off the top of my head.

Share this post


Link to post

Thanks JB,

 

This partly works. For SelectObj it works, but for ForEachObject it doesn't.

 

I have had to use ForEachObject without PP and then check each "h" with "if (GetLSN (h) <> Line_Index) then" before running the code.

 

I still think there is a bug with ForEachObject (Do_This, ((T = Line) & (PP = Line_Index))); not recognising the PP

 

Share this post


Link to post

You have to declare a sub procedure (or sub function I can never remember which is used for ForEachObject and which for the FEOInList) and use that as part of the procedure call.

 

Try:

procedure test;
var Line_Index : longint;

	Procedure Do_This;
		Begin
			SelectObj ((PP = Line_Index));
			Message (GetLSN (FSActLayer), '  ', Line_Index);
		End;

begin

ClrMessage;
Line_Index := GetLSN (FSActLayer);
Message (Line_Index); Wait (2);
DSelectAll;
		{SelectObj ((PP = Line_Index));
		Message (GetLSN (FSActLayer), '  ', Line_Index);
		}
ForEachObject (Do_This, ((T = Line) & (PP = Line_Index)));

end;
run (test);

Too late for testing tonight. 

 

HTH

Share this post


Link to post

Hi Pat,

 

When you get back, try this with a line that has Line Type "Circles" or anything but "Solid" or "Pattern". It won't work.

 

procedure test;
var Line_Index : longint;

    Procedure Do_This (h : handle);
        Begin
            SelectObj ((PP = Line_Index));
            Message (GetLSN (h), '  ', Line_Index);
        End;

begin
ClrMessage;
Line_Index := GetLSN (FSActLayer);
Message (Line_Index); Wait (2);
DSelectAll;
ForEachObject (Do_This, ((T = Line) & (PP = Line_Index)));
end;
run (test);

Share this post


Link to post

Take a look at this version. It selects all of the lines in the file with the same LineStyle as the first selected object on the layer.

 

procedure test;
var Line_Index : longint;
	LineStyleName : String;
	ListID: longint;
	ListItems: LongInt;
	
    Procedure Do_This (H1 : handle);
        Begin
            SetSelect(H1);
            RedrawAll;
            Message (GetLSN (h1), '  ', Line_Index);
            Wait(1);
        End;
begin
ClrMessage;
Line_Index := GetLSN (FSActLayer);
LineStyleName :=GetDashLineTypeName(Line_Index);
DSelectAll;
ForEachObject (Do_This, ((T = Line) & (LT = LineStyleName)));
end;
run (test);

I had to do some digging to realize the GetDashLineTypeName was the key to getting the LineStyleName so the criteria will work properly.

Share this post


Link to post

I think this will work 😃

 

Interestingly, JB mentioned the LT option but it's not in the Appendix "Attribute Criteria" and therefore I thought it was a typo when his eg. used PP again. Sorry.

 

Share this post


Link to post

@JBenghiat is rarely wrong 😉

 

I think that sometimes both he and I go a little too fast in trying to help and sometimes answer a different question than is actually being asked.  But if you are persistent we usually figure it out and some up with a working solution.

 

If you don't care about seeing each line select in turn, you can delete the Message and Wait statements and move the RedrawAll statement to just before the last End statement and the script will run much faster.

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...