Jump to content

yasin2ray

Member
  • Posts

    135
  • Joined

  • Last visited

Posts posted by yasin2ray

  1. On 4/27/2023 at 12:37 AM, Pat Stanford said:

    Take a look at the attached file.  I have written two scripts that combined do what I think you need.

     

    One script is used to make a Database Row with all of the  PIO Object Styles in the file (Resource Manager) that match a given PIO Name. This is used in Row 5 of the worksheet. To change, right click in the Row 5 header and choose Edit Database Formula. You will see the formula of:

     

    =DATABASEBYSCRIPT('DBBS-PIO-Styles', 'Data Tag')

     You should be able to use the same script and change the 'Data Tag' part to a different object name and get a database of a different type of object.

     

    In order to get the name of the style you have to use a worksheet script. This is in cell B5. The function you need is:

     

    =RUNSCRIPT('GetStyleName')

     

    You will need to have the scripts from the "Database of Plug-in Styles" script palette in any file where you want this functionality.

     

    This is a VW2023 file. The functionality should works back to at least VW2021.

     

    HTH.

     

     

    WS of ObjectStyles.vwx 458.03 kB · 4 downloads

    THANKS, Pat!

    I finally got this all downloaded and organized. I'm exited to try it out!

    Anna

  2. We make our own Symbols, attach our own Record Formats to them, and some of the fields need to be set and unchangeable while other fields, after the symbol is placed, get info entered on an individual basis. See the included screenshot for the fields at the top that are set on an individual basis after the symbol is placed in design space. The fields below in the red box should apply to all instances and be a different color or even completely unchangeable (unless the change is applying to every instance).

     

    One way to think of it, for the fields that I want to be unchangeable, I need them to behave like a "black symbol", where "changes made to the symbol definition effect all instances of the symbol".

     

    Please send me your ideas and tips!

    Thanks,

    Anna Arbetter

     

     

     

    Screenshot_make embedded RF settings unchangeable-area in red box unchangeable.jpg

  3. I'd like to make a guide for my office that lists all the Data Tags we have and the Feature they each label.

    I've started a worksheet but the function =NAME does not work to list the name of Data Tags in the Resource Manager.

    In fact, worksheets can't list anything that's in the Resource Manager and not placed in the file. Is there a way to list things that are in the Resource Manager? Data Tags, names of symbols, etc?

    Is there any data-driven way to make this?

    THANKS!

    Anna

    Data Tag style-name list_function needed.jpg

  4. 3 hours ago, Pat Stanford said:

    You should not need to change anything inside the script.

     

    What is the name of the Layer that you have your Outfall objects on?  Do you have objects on that layer that show names at the bottom of the OIP?

     

    What is the name of the script showing in the script palette?

     

    DM me a file showing Outfall objects, Zone objects, the objects you want to report on, and a worksheet/database that lists those objects.

     

     

    Pat,

    I made this file for you. It has a real example from the project I'm working on. There is a note to you on the Notes layer, none class.

    THANKS! I hope we can get this working. The way Vw worksheets work for this kind of info (without a fancy addition like a script) is not at all ideal.

    Anna

    Futurity-Arbetter_trying to get location name into worksheet columns.vwx

  5. 17 hours ago, Pat Stanford said:

    This returns the Loc object name based on only the Layer the object is in and that it has a name.

     

    The WS formula is something like:  =RUNSCRIPT('LocNameByLayer', 'Design Layer-1')

     

    This assumes you make a script named LocNameByLayer and paste in the following script:

     

    Procedure LocNameByLayer;
    
    {December 15, 2022}
    {©2022 Patrick Stanford pat@coviana.com}
    {Licensed under the GNU Lesser General Public License}
    
    {No Warranty Expressed or Implied. Use at your own risk.}
    
    CONST	SQ = CHR(39);
    
    VAR		ThisObject					:Handle;
    		ThisClass, ThisLayer		:String;
    		LayerCriteria, LocCriteria	:String;
    		ThisResult					:Real;
    
    PROCEDURE GetCheckLocObject(Hd1:Handle);
    VAR		LocName						:String;
    BEGIN
    	LocName:=GetName(Hd1);
    	If LocName <> '' THEN
    		BEGIN
    			LocCriteria:=Concat('((LOC=',LocName,'))');
    			ThisResult:=Eval(ThisObject, LocCriteria);
    			If ThisResult=1 then WSScript_SetResStr(LocName);
    		End;
    
    End;
    
    Begin
    	ThisObject:=WSScript_GetObject;
    	ThisLayer:=WSScript_GetPrmStr(0);
    	ThisClass:=WSScript_GetPrmStr(1);
    	LayerCriteria:=Concat('((L=',SQ,ThisLayer,SQ,') & (N<>',SQ,SQ,'))');
    	ForEachObject(GetCheckLocObject, LayerCriteria);
    End;
    
    Run(LocNameByLayer);

     

    It's not working! I don't know what's wrong!

    I need clarification on this statement: I do not need to make any changes to the text inside the script. Correct?

    Anna

  6. 5 minutes ago, Pat Stanford said:

    The LocNameByLayer-Class does what you want.

     

    You specify a worksheet database with criteria that returns all of the objects that might be in your Outfalls or Reference Zones.

     

    You then put in a formula similar to:

     

    =RunScript('Name that you saved the script with', 'Actual name of the layer your Loc objects are on', 'Actual name of the class your Loc Objects are in')

     

    The script will then return the Name of the Loc object in the specified Layer and Class that the object is in. Or if it is not in a Loc object with that Layer and Class it will return a blank cell.

     

    So you put the RunScript formula into two database header row cells. In one you put the Layer and Class of the Outfall Loc objects. In the second you put the Layer and Class of the Reference Zone objects.

     

    Or Post or DM me a file and I will make it work.

     

    The layer-class script won't work because my query/zones are one per class (to define attributes). If it were LocNamebyLayer, that would work. Just not class.

    Anna

  7. On 12/1/2022 at 4:22 PM, Pat Stanford said:

    Try this one. It will check each object to find those that are in either of two LOCs specified in the WS Formula and return the same name of the LOC as you specified.

     

    The formula you will need will be something like:

     

    =RunScript('WhichLoc', 'Outfall Drainage Area', 'Reference Zone')

     

    The object defining the area MUST have exactly the same name as what you put inside the quotes for each name. What is inside the quotes for each name is what will be returned in the cell for an object in either area. If the object is not in either area it will return an empty cell.

     

    Paste the following text into a new blank Script giving it a name of WhichLoc.

     

    Procedure WhichLoc;
    {Decemeber 1, 2022}
    {©2022 Patrick Stanford pat@coviana.com}
    {Licensed under the GNU Lesser General Public License}
    
    {No Warranty Expressed of Implied. Use at your own risk.}
    
    
    VAR	Result1, Result2	:	Real;
    	NameOfLoc1, NameOfLoc2, CriteriaToEvaluate: String;
    	WSSubrowObjHand		: Handle;
    
    BEGIN
    	WSSubrowObjHand:=WSScript_GetObject;
    	NameOfLoc1:=WSScript_GetPrmStr(0);
    	NameOfLoc2:=WSScript_GetPrmStr(1);
    	CriteriaToEvaluate:=Concat('((LOC=',NameOfLoc1,'))');
    	Result1:=Eval(WSSubrowObjHand, CriteriaToEvaluate);
    	
    	CriteriaToEvaluate:=Concat('((LOC=',NameOfLoc2,'))');
    	Result2:=Eval(WSSubrowObjHand, CriteriaToEvaluate);
    	
    	WSScript_SetResStr('');
    	If Result1=1 Then WSScript_SetResStr(NameOfLoc1);
    	If Result2=1 Then WSScript_SetResStr(NameOfLoc2);
    End;
    
    Run(WhichLoc);

     

    Ask again if you need more information.

    Pat,

    I'm trying the WhichLoc script and it's not working at all. I see you said I need to have the names of possible areas in the cell. Do I need to make any changes to the script text itself? Does the script text need to same names of areas in it?

    Thanks!

    Anna

  8. On 12/1/2022 at 11:26 AM, Pat Stanford said:

    Perhaps a better way would be to have a script that would take a LOC (or multiple LOCs) and assign a record to all of the objects in that LOC that you could then query in a worksheet. It won't be automatic and you will have to re-run the script if you add new objects or move things between LOCs, but at least it won't run every time the WS is recalculated.

     

    Would you be willing to assign a Record (or use a single class) for all of your LOC objects? That could simplify what needs to be done and prevent having to test every object in the drawing against every other object in the drawing.

    Pat,

    I need a solution as soon as possible. Is this something tech support could help with? There needs to be a way for Vw to do this (and one that doesn't require me to pay for it).

    I just reread this part of what you wrote. This would be an option as well. I'd love to try it if you made the script. Would I then just need to add a field to the record format that's already attached to the objects (symbols)?

    Anna

  9. On 12/7/2022 at 6:51 PM, Pat Stanford said:

    Try this one.

     

    I extrapolated a little bit.  It will compare every item in the database to every named object in the Layer and Class combination that you pass in the parameters for the script. So this one script should handle both your zones and outfalls by just changing the layer and class specified as containing the LOC objects.

     

    The attached file has a sample.  The brown and green rectangles are in the Outfall class. The rounded rectangles are in the Zones class. The lines and the ovals are in the Objects class. The database has a criteria of Class is Objects.

     

    Put the script in a database header row cell using a formula like:

     

    =RUNSCRIPT('LocNameByLayer-Class','YourLayerName','YourClassName')

     

    HTH

     

    Procedure LocNameByLayerClass;
    
    {December 7, 2022}
    {©2022 Patrick Stanford pat@coviana.com}
    {Licensed under the GNU Lesser General Public License}
    
    {No Warranty Expressed or Implied. Use at your own risk.}
    
    {worksheet script to return the name of the LOC an object is in.}
    {This script checks a Layer and Class combination for possible LOC objects. Must be named.}
    {It then checks if the object in the current database subrow}
    {is in that LOC. If it is, it returns the name of the LOC. If not it returns blank.}
    
    {Overlapping LOCs will return whichever object happens to evaluate last.}
    
    {Run using a WS formula of =RUNSCRIPT('LocNameByLayer-Class','YourLayerName','YourClassName')}
    
    CONST	SQ = CHR(39);
    
    VAR		ThisObject					:Handle;
    		ThisClass, ThisLayer		:String;
    		ClassCriteria, LocCriteria	:String;
    		ThisResult					:Real;
    
    PROCEDURE GetCheckLocObject(Hd1:Handle);
    VAR		LocName						:String;
    BEGIN
    	LocName:=GetName(Hd1);
    	If LocName <> '' THEN
    		BEGIN
    			LocCriteria:=Concat('((LOC=',LocName,'))');
    			ThisResult:=Eval(ThisObject, LocCriteria);
    			If ThisResult=1 then WSScript_SetResStr(LocName);
    		End;
    End;
    
    Begin
    	ThisObject:=WSScript_GetObject;
    	ThisLayer:=WSScript_GetPrmStr(0);
    	ThisClass:=WSScript_GetPrmStr(1);
    	ClassCriteria:=Concat('((L=',SQ,ThisLayer,SQ,') & (C=',SQ,ThisClass,SQ,') & (N<>',SQ,SQ,'))');
    	ForEachObject(GetCheckLocObject, ClassCriteria);
    End;
    
    Run(LocNameByLayerClass);

     

    Return Loc Name Defined By Layer and Class.vwx 89 kB · 0 downloads

    Hi Pat,

    This is getting confusing. This one won't work for the way I have things set up. Ref Zones and Outfall areas are on different classes that define their attributes. Can I somehow send you a file with an example of my objects (they are symbols) and the various Outfall Drainage Areas they might fall within (one outfall area per object/symbol), and Reference Zones (one reference zone per object/symbol)?

    Does this explanation help you understand what I'm trying to achieve?

     

    I'm thinking the WhichLoc script might be the way to go. I would need to separate it into two scripts though, one for each column/location. I would use WhichLocOutfallArea for the column that lists which Outfall Area an object (symbol, set in row Criteria) exists within. I would use WhichLocRefZone for the column that lists which Reference Zone an object (symbol, set in row Criteria) exists within.

    What do you think?

    THANKS!

    Anna

  10. On 12/5/2022 at 5:40 PM, Pat Stanford said:

    Almost anything is possible. It is just a question of time, money, and desire. 😉

     

    If I am reading you correctly, Outfalls and References are completely different things, but you just happen to what to generate the same kind of name list for each of them.

     

    If you put all of your Outfalls into a single Layer/Class combination, then yes, we should be able to gather the names of each Outfall based on the objects in that combination. But you will have to make sure that ONLY the Outfall areas are in that combination.  The same for the References.

     

    Do you actually want different columns for the Outfall and the Reference? Or do you want them interspersed in the same column?

     

    One of the reasons I sometimes don't answer questions like this is that "scope creep" always comes once you see what can be done. 😉

     

     

    I understand.

    For now, it would be fine to keep the two "Locations" separate: a column for Outfall location, a column for Reference Zone location.

    Additionally, it could be one columns and the result would produce "Outfall location, Reference Zone location" (a comma between the two). - But I would want to see the other two individual ones as well. This would be in addition to those so I can how it all plays out and decide what works best.

     

    What are you thinking now?

  11. On 12/1/2022 at 6:56 PM, Pat Stanford said:

    Ask if you need more clarity.

    Hi Pat,

    I have some questions. How would you make each of these?
    I need to turn your WhichLoc script into two scripts: WhichLoc_Outfall Drainage Area and WhichLoc_Reference Zone.

     

    The possible Outfall Drainage Area locations are:

    query Outfall 1 Area

    query Outfall 2 Area

    query Outfall 3 Area

     

    The possible Reference Zones are:

    EZ1

    EZ2

    EZ3

    IZ1

    IZ2

    IZ3

    IZ4

    IZ5

    IZ6

    IZ7

    IZ8

    IZ9

    IZ10

    IZ11

     

    Is it possible to have the results return the names without telling it what the possible names are? Can I instead set criteria such as class and layer and it looks at the Name of objects meeting those requirements (class and layer)?

  12. 50 minutes ago, Pat Stanford said:

    Try this one. It will check each object to find those that are in either of two LOCs specified in the WS Formula and return the same name of the LOC as you specified.

     

    The formula you will need will be something like:

     

    =RunScript('WhichLoc', 'Outfall Drainage Area', 'Reference Zone')

     

    The object defining the area MUST have exactly the same name as what you put inside the quotes for each name. What is inside the quotes for each name is what will be returned in the cell for an object in either area. If the object is not in either area it will return an empty cell.

     

    Paste the following text into a new blank Script giving it a name of WhichLoc.

     

    Procedure WhichLoc;
    {Decemeber 1, 2022}
    {©2022 Patrick Stanford pat@coviana.com}
    {Licensed under the GNU Lesser General Public License}
    
    {No Warranty Expressed of Implied. Use at your own risk.}
    
    
    VAR	Result1, Result2	:	Real;
    	NameOfLoc1, NameOfLoc2, CriteriaToEvaluate: String;
    	WSSubrowObjHand		: Handle;
    
    BEGIN
    	WSSubrowObjHand:=WSScript_GetObject;
    	NameOfLoc1:=WSScript_GetPrmStr(0);
    	NameOfLoc2:=WSScript_GetPrmStr(1);
    	CriteriaToEvaluate:=Concat('((LOC=',NameOfLoc1,'))');
    	Result1:=Eval(WSSubrowObjHand, CriteriaToEvaluate);
    	
    	CriteriaToEvaluate:=Concat('((LOC=',NameOfLoc2,'))');
    	Result2:=Eval(WSSubrowObjHand, CriteriaToEvaluate);
    	
    	WSScript_SetResStr('');
    	If Result1=1 Then WSScript_SetResStr(NameOfLoc1);
    	If Result2=1 Then WSScript_SetResStr(NameOfLoc2);
    End;
    
    Run(WhichLoc);

     

    Ask again if you need more information.

    Thanks!

    I see I didn't explain the two "locations" well enough but your explanation of how to edit it should get me through. I'll let you know how it goes!

  13. Using the "Auto Fit Row Height" is not working for me (since starting v2023).

    Anyone else experiencing this?

    The row height is not moving to meet the size of the font and when it's a long amount of text with "wrap text" checked, the row height does not get taller to display the second row of text.

    I've tried everything I can think of and it's not working.

    Anna

  14. 26 minutes ago, Pat Stanford said:

    It can't really do what you want.

     

    A "Location" is actually just a test to see if a given object "overlaps" with another Named object. This data is not stored with the object and has to be recalculated every time the worksheet is recalculated, for every object in the database criteria. This is likely to be very slow.

     

    Also, what should be returned in you have two named objects that overlap and an object falls within them both? That object is in both locations. Should it return both of them? Only the first? Only the second? What about a third overlapping Loc?

     

    It can probably be done with a worksheet script similar to the IsLoc script I send you a while ago, but it will be much longer and more complicated.

     

    Think about what you really need and post it and I will consider if I have the time and energy to work on it.

     

    Perhaps a better way would be to have a script that would take a LOC (or multiple LOCs) and assign a record to all of the objects in that LOC that you could then query in a worksheet. It won't be automatic and you will have to re-run the script if you add new objects or move things between LOCs, but at least it won't run every time the WS is recalculated.

     

    Would you be willing to assign a Record (or use a single class) for all of your LOC objects? That could simplify what needs to be done and prevent having to test every object in the drawing against every other object in the drawing.

     

    Pat,

    Here's the situation: Things either (1) won't fall into multiple query areas or (2) will fall into more than one query area but only query areas of different types.

    We have two query types: Outfall Drainage Area and Reference Zone.

    I'd love to have one column titled Outfall Drainage Area and the answers below are the names (could be 1, 2, 3) and another column for Reference Zone and the response below could be EZ1, EZ2, IZ1, IZ2, etc.

     

    I do use the IsLoc script you made for me!!!!

    The issue with it is that it outputs an X in the column for it's Location. So I have to have one column per possible location. That takes up a lot of space side to side. I'd love to be able to display the name of the location and use 1 column for it. (or two columns for two different types of locations)

     

    THANKS!

    Anna

×
×
  • Create New...