Jump to content

JBenghiat

Member
  • Posts

    2,024
  • Joined

  • Last visited

Everything posted by JBenghiat

  1. Looks like the process is a little more complex. The link information is attached to a link object in the text object's aux list. This is only possible to access using python: kLinkType = 58 ovLinkFormatUsed = 1350 ovLinkFieldIndex = 1351 auxh = hText.aux hTextLink = vs.Handle(0) while hTextLink == vs.Handle(0) and auxh != vs.Handle(0): if auxh.type == kLinkType: hTextLink = auxh auxh = auxh.next if hTextLink != vs.Handle(0): recIdx = vs.GetObjectVariableInt(hTextLink, ovLinkFormatUsed) fieldIdx = vs.GetObjectVariableInt(hTextLink, ovLinkFieldIndex) recName = vs.Index2Name(recIdx) vs.AlrtDialog( 'Field: ' + recName + ' Index: ' + repr(fieldIdx) )
  2. I think there’s a common misconception that objects don’t get created until the end of the script — for any function that returns a handle, that object the handle points to is immediately available in memory, and all operations using that handle will work. What you won’t see happen until the end of a script is the plug-in object’s code run or it’s geometry created, so if your script depends on the PIO calculating data or parsing it’s geometry, you’ll have issues. There’s a way to force an SDK plug-in to reset immediately, but I don’t think that’s the issue here. Does the name have to be unique? If so, that would cause the command to fail. The name could be set, but you just don’t see it yet. Try calling ResetObj() at the end of the script.
  3. Select everything you want to be considered as a single unit and create a symbol. Set the insertion point to the point where you want to attach to the truss. Do not keep an instance in place. In the Rigging toolset, choose Rigging Load. Attach the Rigging Load to your truss. Check the Show Symbol option, and press Select Symbol to choose the symbol you created. Set the weight of the combined hardware at the bottom of the OIP.
  4. Correct. passing vs.FSymDef() to vs.ForEachObjectInList() is probably the best method. I believe you do have to recursively enter symbol folders.
  5. I'm not entirely sure what you mean here. As Pat remarked, the Resource Manager is only an interface for working with resources. The Lighting Device accepts the name of a symbol (a resource), and copies the geometry of the symbol to the Lighting Device. Lighting Devices also take default data from the symbol on insertion, which you can mimic via script by calling vs.ApplyLightInfoRecord(). An "external reference" in Vectorworks lingo would mean that you are referencing a symbol in another file. Is that what you mean, or are you only trying to determine the connection between the Lighting Device and the Resource Manager. Mapping to a symbol outside of the current drawing file would be where Sam's RessourceList comes in. The following script will add the first row as described, assuming that "D" maps to a symbol named "My Light." It also assumes that the symbol exists in the current drawing. The neutral orientation (pan=0) is towards the top of the page. You can set a different initial orientation with the final parameter in CreateCustomObject(). symbolName = 'My Light' hNew = vs.CreateCustomObject('Lighting Device', (-61,-7.55), 0) vs.Move3DObj(hNew, 0, 0, 11.5) vs.SetRField( hNew, 'Lighting Device', 'Symbol Name', symbolName) vs.ApplyLightInfoRecord(vs.GetObject(symbolName), hNew) vs.SetRField( hNew, 'Lighting Device', 'Pan', '-7') vs.SetRField( hNew, 'Lighting Device', 'Tilt', '46') vs.ResetObject(hNew)
  6. @Sam Jones why not just use vs.GetObject() to get the symbol definition by name and vs.GetTypeN() to confirm that it's a symbol definition? Then all the Lighting Device needs it the name of the symbol.
  7. You could always define the ptr in ModuleMain and then initialize if nullptr in the OnInitXProperties events. That's assuming that you don't need to re-initialize if the user makes a change to the color table.
  8. The simple answer is, yes, this is definitely possible. Also, we're assuming you mean a Spotlight Lighting Device object and not a rendering spotlight. (Both are possible). You would use vs.CreateCustomObject() to insert a Lighting Device at the desired location and orientation, vs.HMove3D() to set the z location, and then set the Lighting Device fields for pan, tilt, and which symbol to use. The least straightforwards element is mapping the key value (e.g. "D") to the name of the symbol you want to use for the lighting device. You can hand-code a dict, read from a worksheet, attach a record to the symbol, etc.
  9. VS does not have the ability to delete or rename a field. I suspect Sam is correct -- the only solution is brute force: - Rename the old record - Create the new record - Attach the new record to the same objects as the old record - Copy all data from instances of the old record to new - Iterate over all text object in symbols, and re-link to the new record - Delete the old record The following object variables can help you work with linked text: ovTextIsLinkedToRecord = 680; // Boolean, read only - Public for VS ovLinkFormatUsed = 1350; // InternalIndex - the RefNumber of the format this links to ovLinkFieldIndex = 1351; // short - the index of the field of the format used
  10. The VP cache just literally contains the lines and polylines that make up the hidden line render. If you're annotating by the physical appearance in the VP (e.g. object heights), this could work, but you won't be able to access the drawing objects. Data tags use some special code that's not available in VS or the SDK. My guess it that the attachment tool is using the VP view and visibility settings to query objects in the corresponding design layers.
  11. @mjm My point was not that Vectorworks won't crash, but that I often hear users who think they did something wrong, or have a computer that's not up to spec, or too many browser tabs open, and don't report the bug. In my experience, crashes that are consistently reproducible and have test files and either detailed steps or videos attached get resolved fairly quickly. While VW does get crash reports from Apple and MS, there's usually not enough data in the report alone to diagnose and fix the bug.
  12. - Vectorworks should never crash, even if a user does something incorrectly, so you should report this as a bug, attaching your file and providing instructions how to reproduce. https://www.vectorworks.net/support/bugsubmit - The Light Info Record only sets Lighting Device default data, so unless you want to change the data in existing Lighting Devices, you don't need to take any further action. The symbols should be available to add to the summary as soon as you attach the LIR. - Lighting Symbol Maintenance, under Spotlight>Reports, makes managing the LIR a lot easier. It helps ensure you don't enter bad data (which could be your issue), and has an option to push out any changes to existing Lighting Devices.
  13. The layout items are all plug-in objects; insert a static text item and then change it's type to the desired item. Note, you are building more of a connected tree than a visual layout, a lot like marionette, so what you see in the VW document looks nothing like the resulting dialog.
  14. Or more specifically, the OIP configuration saves with the file. The setting in Preference will also become default for the subsequent new file. In most cases, I'm dealing with one of two scenarios: I have a house inventory, and no one is dealing with clamps in the paperwork, or I have a production electrician in charge of pulling iron, and then they're using a separate "Iron" field in LW and not an accessory in VW. Either way, I don't want clamps to show up as accessories. I also don't really care about seeing the right hanging hardware in 3D, as long as the distance below the pipe is correct.
  15. Just thought I'd mention, in addition to the solutions you can find in AutoPlot, Savvy Select Similar Instrument will do this as well https://benghiatlighting.com/software/product/savvy-select-similar-instrument-3/
  16. I figured out the issue. buildvwr.exe requires the 64 bit versions of msvcp100.dll and msvcr100.dll, which aren't included in Windows 11. I was able to grab copies from a wine install, and now the build functions without error. I'll attach here if anyone else runs into this issue. msvc*100_dll.zip
  17. @mjm I'll add that your Object Info seems to be using custom parameter settings, and is out of date. The standard configuration has "Edit Cell" and "Edit Accessory" dropdown menus under Instrument Type, which would make it more clear that you have the light's accessory selected.
  18. It's a hidden record. Get a handle to the record format via it's name. It's possible that the values get loaded into memory, so changing the stored value may have no effect.
  19. Your symbols are constructed with your clamps as accessories (this is how they default now, and I'm not in favor if this unless you're pulling a complete shop order). When SSS turns blue pre-selection, it's letting you know that you're hovering over an accessory. You're not changing your Lighting Devices to accessories; what you're seeing is the tool selecting all the clamps for you and setting that as the active component to edit in Object Info. Either remote Light Info from the clamp in your lighting symbols, or be careful where you're clicking. HTH
  20. Check out AutoPlotVW. This is just one of the many useful commands you can find in its roster. http://autoplotvw.com Criteria can't accept a list of options. You can parse the input string, and if it's in the format (\d+)-(\d+), construct criteria that links something like: ((('Lighting Device'.'Channel'<='103') & ('Lighting Device'.'Channel'>='101'))) but that won't handle non-contiguous ranges the way AutoPlot can. Unless you want to develop the script for learning purposes or as a step for a more complex script, AutoPlot will be well worth the potential hours spent.
  21. JBenghiat

    Vectorworks API

    There's an SDK. The documentation is out of date and incomplete, but the examples in the SDK download are current. https://developer.vectorworks.net/index.php/SDK
  22. I've had to re-install Windows, which meant updating to 11, and now I can't get buildvwr.exe to run without error. I have a few questions: - Is the .vwr the same for Windows and Mac? If so, I can just copy from the Mac install and avoid this issue - Looking at a previous .vwr built with the Windows script, it appears to be a zip file. This seems to be contrary to the information in the developer wiki, which states the .vwr is just a directory with an extension (which is definitely true on Mac) - If the answer to my first question is "no," has anyone encountered this and figured out a solution? As a side note, I've eliminated the buildvwr step when compiling on Mac, and used a Copy Bundle Resources step, which both copies the .vwr and sets any needed permissions and flags.
  23. The script needs to actually hide the objects, as opposed to turning them off. Vectorworks allows you to set the visibility of individual objects, but as viewports have mostly eliminated the need for this, it's only accessible via script. Here are two one-line scripts to hide and show all lights. Hide((INSYMBOL & INOBJECT & INVIEWPORT & (T=LIGHT))); Show((INSYMBOL & INOBJECT & INVIEWPORT & (T=LIGHT))); Hiding objects has some caveats -- for example, a hidden object can still be selected, causing unpredictable results with some commands.
  24. Two things are happening: 1. Your drawing is not as accurate as you think it is. Change your units to a decimal precision of .001, and you'll see that your extrude dimensions are rounding to the nearest mm in Obj Info. 2. GetSymLoc3D is getting the translation of the symbol's transformation matrix. For objects with a 3D rotation, this seems to take the layer elevation into account. For unrotated objects, it does not. That could possibly be a bug. In order to get the correct location: - Use GetSymLoc3D() for the z only. Use GetSymLoc() for the x and y - Use Get3DOrientation to get the axes rotations. If the x or y is non-zero, the z will have the layer elevation included in the value. Adjust accordingly.
  25. Are you aware of the VectorScript function reference? https://developer.vectorworks.net Symbol() won’t help you at all — it places a new symbol in then drawing, and does not accept a criteria as a parameter. If you want to use criteria, I think Eval() should work. You need to get the handle of the resource in the list, check if the record is attached, and if so return the name, otherwise return an empty string. Otherwise, the check involves getting the number of records attached to the symbol, getting a handle to the record by index, and checking if the name matches. For a function to return a value in VS, set the name of the function to the value (you are not returning anything here). Also, your while loop will stop as soon as you a counter a symbol without your desired record attached. Instead, consider getting the number of resources in the list and using a for loop.
×
×
  • Create New...