Jump to content

Pat Stanford

Moderator
  • Posts

    12,711
  • Joined

  • Last visited

Everything posted by Pat Stanford

  1. 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?
  2. 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.
  3. 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.
  4. 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!!
  5. 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.
  6. Do you intend to have the viewport in perspective view? If not set the Projection to Orthogonal and the frame corners will go away. I have not tried using multiple view panes. Maybe later.
  7. 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.
  8. 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.
  9. @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?
  10. In 2019 it does not work in Section Viewports, but it certainly works in regular viewports in 3D views.
  11. Better Option. Edit the Crop of the viewport. Switch to the Translate View tool (or Walk through, or Flyover depending on what kind of a view you are in) and you will be able to leave the crop object in place and move the design layer(s) behind the crop. Annotations stay in place also.
  12. 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.
  13. 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.
  14. 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.
  15. OK, I found it. I was looking in the completely wrong place. The following script should do what you want for the first selected object on the active layer. If it appears to work for you AND you want to learn more about scripting come back and we can talk about how to make it operate on all of the objects in the drawing. Procedure LDRotation; Var H1:Handle; B1:Boolean; ORot:Real; Begin H1:=FSActLayer; ORot:=HAngle(H1); SetRField(H1,'Lighting Device','Rotate3DPosition','True'); SetRField(H1,'Lighting Device','EnableZRot','True'); SetRField(H1,'Lighting Device','zRot',Concat(ORot)); ResetObject(H1); End; Run(LDRotation);
  16. Yes, what you want should be possible. However, I am not a Spotlight user and I can't find where you "Enable Set 3D Orientation" or most of the rest so you will need to explain to me more clearly what you are actually trying to do and how you currently do it manually. This would not be a bad script to learn on IF you want to learn to script. If you don't want to learn that we call @Sam Jones and see if his Autopilot Tools already have this functionality.
  17. I don't believe there is a way in VW2019 and before to use tags in criteria. Would it be better to use a positive entry for layers that you DO want in the worksheet rather than a negative entry for layers you DON'T want? That way you would only need to edit the criteria if you added a layer that you wanted to keep.
  18. It is hidden in the GROUP category in the function reference. Effectively each viewport has an Annotations Group, a Crop Group, etc. Check out GetVPClassVisibility and SetVPClassVisibility.
  19. Just tested. Not alphabetical. Let m ponder this....
  20. That I am not sure about. I think it may be alphabetically the first line type in the file. Does that seem reasonable in your case? Can you rename the line types? Hopefully someone else will help us out here.
  21. Line Type defaults are set the same way as almost any other default in VW. With nothing selected in the drawing change the settings in the Attributes Palette. Select the Line Type you want to be the default. After that any line you draw will use that Line Type. For Text defaults make sure nothing is set in the drawing and and set what you want from the Text menu to set default Font, Style, and Size.
  22. A little more background: Any data shown in a worksheet using a =Record.Field formula is two way editable in either the worksheet of in the Object Info Palette. These can be either custom records that are attached to any object type, or the special PIO record that is used by each PlugIn Object and are typically seen on the Shape pane of the OIP or in the Settings dialog box. So ='Door'.'Width' will be two way editable from a worksheet. =Width for a door will return the width of the bounding box and will not be editable from the worksheet. Depending on the PIO, there are some fields that may be read only or that may not behave properly if set from a worksheet rather than letting the PIO do the calculations, so some caution is advised.
  23. Or use a Prefix (VW2019 Advanced button, Classes and Layer pane) when you import the DWGs so that they will already be subclasses to a class named as the prefix.
  24. Yes, there was some discussion of using the wall tool to draw flats. I have asked the person I think was involved in the discussion but have not heard back. If I remember correctly, it was a heavy line on one side, no line on the back side and a solid fill. And as you have stated with there are other things you should be doing, there is a good reason we actually call it the Vectorworks Abusers Group. Though sometimes I think it is called that due to all the abuse I take when I mess up. 😉
×
×
  • Create New...