Jump to content

Pat Stanford

Moderator
  • Content Count

    5,259
  • Joined

  • Last visited

Posts posted by Pat Stanford


  1. LOC only works for 2D objects (polys, rects, ovals, etc.) and spaces as far as I know.  It does not work for Groups or 3D objects (other than spaces) or other PIOs (there are probably some exceptions, but I don't know them.)

     

    But it does work even when the objects are INSIDE of groups.  So you can't set the Group to be TMP, but you can enter the group, name the big poly and then exit the group and LOC will still work.

     

    Does that help?

     


  2. Nice work. I thought I had responded last week, but it ended up  sitting as a draft.

     

    You ended up exactly what I was going to recommend. Add 2 then add Repeat add 1 to the result.

     

    You might need to add some error checking. The manual for AddSurface says it only works with overlapping objects. You could get a nil handle for the added object if they don't overlap.

     

    Good Job!

    • Like 1

  3. Give them both separate names and use LOC Is Within Big Poly & LOC is Not Within Little Poly?

     

    But I don't think that will get you an object the partially overlaps the small poly. You will probably have to manually compare the bounding boxes of the small poly to each object inside the large poly to check for overlap.


  4. Yes,

     

    Anything you can do in VS you can also do in Pythonscript. In Pythonscript you can actually do more. I just personally dislike the white space as delimiter notion of Python. Makes it very hard for me to debug.

     

    Quote

    Python:

    def  vs.SetMeshVertex(hMesh, index, pt):

       return None

     

    Yes you can get and set vetches of mesh objects with Python. You need a handle to the mesh, an index to the vertex you want to move, and just pad the X/Y/X positions you want it to take.

    • Like 1

  5. Yes, you can use Marionette for this, but this is the type of thing that I think Vectorscript (VS) is better at than Marionette.

     

    Many of the things you have listed above are a single line of code in VS once you get a couple of 10-20 line "wrappers" that you can basically reuse. In Marionette since everything is a node, you end up having to add a lot of extra nodes to do some of these things.

     

    It will also depend on more explicitly what you are trying to do. If you want to operate on a single selected object that will be much easier than if you want to operate on multiple objects in the drawing.

     

    The Marionette Gurus and I have a friendly ongoing debate about Marionette vs VS.

     

    What type of object are you talking about with a Face Size?

     

    Give us a little better description of what you want to do and we can offer better recommendations.

    • Like 1

  6. Not easily.  It appears that the Racks in the Objects-Ent Stage:Rack Cases.vewx are all individual symbols rather than being a plugin object (PIO).

     

    That means that you will not be able to easily modify the size.

     

    If I am missing a PIO that generates a case, then you could theoretically write a script that would get the dimensions and center point of your extrude, delete it, and them place a PIO at that location and set the parameters for the size.

     

    You could theoretically do this with the symbols, but you would have to go through the list and pick the ones that are closest to your dimensions which many not be close enough for your needs.

     

    If you have not scripted before there is a pretty steep learning curve. As in 5 to 10 hours or more. It will depend entirely on your programming experience and how many bells and whistles you need. Make sure you really define the problem with all of the exceptions before you start trying to write it.

     

    Hopefully someone else has a better answer.

     

    If you decide to go with a script I will be glad to try and help. Just ask again.


  7. ForEachObject handles the Handles for you. ūüėČ

     

    Notice the definition of Callback(H1:Handle);  

     

    What this means is that  the procedure has to be passed the handle to an object to be able to run.  So if your were going to "manually" call the procedure you would have to do something like Callback(HandletoMyObject); or else you would get an error.

     

    Internally that is exactly what ForEachObject does. It makes a list of the handles of all the objects that match the criteria and then it calls Callback one time for each object passing the handle to the object as a parameter. So at the top of Callback H1 will contain the handle to the object passed by ForEachObject. The fact that you redefine what that handle points to does not matter to the code. It just knows that it called Callback with the handles it was supposed to use.

     

    Clear?


  8. Hi @EBV_Nick The SetDSelect is ingenious, but not the solution I had in mind.

     

    I would have just removed the FSActLayer.

     

    ForEachObject passes the handle to the object to process to Callback, so H1 already has the object to process so you don't need to assign the variable.

     

    What you have now works great with the criteria we are using, but would fail if you changed the criteria to be objects that are not Visible and Selected. [VSEL] or even if they are visible and selected but not on the active layer.

     

    Glad I was able to help. Ask again if things are not clear.


  9. The order you are stating sounds strange, but that definitely sounds like a Text sorting versus Numeric sorting problem.

     

    The field you are using is probably stored as Text. That way if you need sheet 3A you can have it rather than just numbers. 

     

    But when you have a Text field it sorts using alphabetic (ASCII) sorting rather than numeric.

     

    So it sorts by the first character, then by the second character, then the third, etc. So you get something like:

     

    1, 10, 11, 2, 3, 4, 47, 48, 5 ....

     

    The traditional work around for this is to use leading zeros so that all of the numbers are the same number of characters.

     

    01, 02, 03, 04, 05, 10, 11, 47, 48.  

     

    If you need more than 99 sheet you need to pad to 3 characters,  001, 002, 010, 011,  etc.

     

    But send Nikolay a movie anyway so he can make sure there is not another bug hiding here.

    • Like 1

  10. There are lots of different ways to loop through multiple objects in a VW drawing and then do something to them. You can use a Repeat...Until loop (executes 1 or more times) or a While loop (executes zero or more times). But in these cases you have to manually change the handle to point to the next object you want to process.

     

    I think in this case we are going to start with a different looping mechanism that hides most of the Handle handling and uses Criteria to define what objects to process. The command we are going to use is ForEachObject.

     

    ForEachObject( callback:PROCEDURE;  c:CRITERIA) a

     

    ForEach Object runs a subprogram (a procedure that takes a Handle to the object to process) one time for each object in the drawing that matches the Criteria. Criteria are a way of specifying what objects to handle. You can use multiple criteria like Layer, Class, Object Type, Selection State, Records attached. Record.Field values that match or don't match a given value.

     

    So what we are going to do is take the script you have written above, convert it into the Procedure needed fro the ForEach Object procedure and set the criteria to what you need.

     

    A user Procedure or Function is just a sub-program written in the script. It starts with a Procedure (or Function) line just like the main script and ends with an End; It does not get a separate RUN() line like the main script because it is called from within the script.  The following is an outline of how a script with user written Procedure would look like:

     

    Procedure Main_Script;
    
    Var	{Enter the names and types of any global variables you need in the script here.}
    	{Variables must be declared in VS}
    
    	Procedure Callback(H1:Handle);  {This defines the name of the procedure and says it needs to be passed a single Handle to run}
    	
    	Var {Local variables go here}
    
    	Begin
    		{Enter the code to do what the procedure needs to do here.}
    	End;
    
    Begin
    	{This is the beginning of the code for the main script}
    	{Do what needs to be done.}
    	{the curly braces signify comments, but you already knew that}
    	{the indentation above is not necessary, but I like it and think it makes it}
    	{easier to read.}
    End;  {end of the script code}
    
    Run(Main_Script}

     

    Now an exercise for the user:

     

    Take the script posted by @EBV_Nick above and make it into a user procedure using the template above.

     

    The body of the main script will be a single line:

     

    ForEachObject(Callback,(((VSEL=TRUE) & (PON='Lighting Device'))));

    This criteria limits the actions to a visible selected lighting devices. We can change the criteria later to handle more objects after we are certain the script is doing what we want it to do.

     

    Ready, Steady, GO!!

    • Like 1

  11. Answering the simple questions first:

     

    HAngle is a Vectorscript (VS) Function (a subroutine that returns a value when it finishes. it must be assigned [:=] to a variable to accept the return value) that takes a Handle (H) [Handle: a numerical pointer to an object in a drawing file. Can change when the file is closed and reopened]. There are a series of functions for inquiring about objects that you can reference by a Handle.

     

    SetRField is a VS Procedure ( a subroutine that does NOT return a value when it finishes. It can change things during execution, but does not have to be assigned to a variable.) It is an abbreviation for Set Record Field. Records are a type of database in VW. Each Record Definition consists of one or more Fields. SetRField is used to store a value into a Record.Field combination. You must know the name of both the Record and Field. PlugIn Objects have what is called the Parameter Record (that used the name of the PIO as the Record Name) that stores all the data you can enter in the OIP (Object Info Palette) (or the Settings dialog boxes) about the object.

     


  12. I just tried in VW2018 and get the same abilities as in VW2019. I think this has been around since the introduction of Viewports.  VW2012? 

     

    I don't know why it is not working for you.

     

    For Section Viewports, if you put a Crop Object in the crop group, then it will not move on the sheet layer. If you go to the design layer and move or resize the Section Marker, what is in the Crop will move to follow the Marker. Not the best option, but better than trial and error.


  13. If you need the text shortening, then the only option is a script. The worksheet text handling is not strong enough to do what you want. It could be a worksheet script, but then there are issues with distributing the script to multiple people. But that is a different discussion.

     

    Another possibility would be to use a Data Tag. You can create a data tag that will return the layer that the tag is on. I have not figured out how to get that data into a worksheet yet.

     

    Longer term, I agree with @Nikolay Zhelyazkov that you should consider turning your title block in to a Title Block Border object. It will help out a lot in the long term.

     

    You should probably also take a close work at your workflow and determine if using viewports and sheet layers would not be a better solution that your strictly design layer (??? at least that is what I have gotten from your posts) current workflow.


  14. @Edgar RAMEL That is a great work around.  Move the last criteria up to replace the one you want to "delete" and then delete the last one!! I love out of the box thinking!.

     

    I don't know of a way to change sort order without effectively deleting all of the sorts and restarting them.

     

    But a quick look makes it appear to be a scriptable problem.  How many different sorts do you need at one time?


  15. 1. There is no such thing as a script that runs automatically when you open or close a file in VW.  It has been asked for for years.

     

    2. Writing data to the worksheet idea might be the best option. Take a look at the script(s) in the follow thread for an idea of how to create and access a worksheet and how to write data into cells.

     

    I think I would start with a small worksheet and just insert a line every time I opened the file. That way the most recent data is always at the top and you always write into the same cell(s) instead of having to figure out how much data you already have.

     

    Another way to do this would be to make a symbol with a Record attached.  When you Open the file, insert symbol instance and write the start time. When you get ready to close, write the stop time. You can then use a worksheet to report on the time in the file. Only problem is if someone deletes the symbol instances.


  16. By Class will definitely work, but what if you have an object that you don't want to be By Class, but want to have a Line Type?

     

    It appears that the default is whatever Line Type was imported/created first in the file with not way to change that. 

     

    I hope I am wrong and there is a way to change it, but I have not found it yet.

     


  17. Viewports are effectively an updatable, "customizable" view into your design layers.

     

    You can set the visibility of which layer and classes you want to see, you can set the scale so you can view a thumbnail or an enlarged detail, and you can crop the view so that you can only see the portion of the drawing that you want to see. You can control the view (especially useful if you are drawing in 3D) and the rendering mode. You can do all of the above individually for each viewport.

     

    The Advanced Properties button lets you adjust the scaling factor of line weights and text, so if you drew at 1/4" and are doing a 3" detail you can thicken up the line weights and enlarge the text so it looks good. Any a bunch of other stuff (like making it Black and White Only).

     

    You can also set Layer and Class Overrides. So if you have objects with their attributes set By Class, you can change the attributes of how the objects look in just that viewport.

     

    You can put multiple viewports on a single Sheet Layer so you can easily do a detail sheet based on the original design layers.

     

    Definitely worth the time to figure out.

 

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.

√ó