Jump to content

Miguel Barrera

Member
  • Posts

    663
  • Joined

  • Last visited

Everything posted by Miguel Barrera

  1. I did test this a long time ago and do not know if it works know. What I found back then was that it returns true only on the first instance of the object in the current document. If you insert any more objects of the same kind in the document, it returns false. I would expect that the function will return true every time that you insert a new object. The workaround that I use is to test for a parameter value that should not be empty. If empty, it is a new object. If it has a value, then it has gone thru the reset event already. As Raymond described above, the first iteration of the reset event draws the outline of the object but the parameters are not filled in if you have any SetRField calls. It is on the second reset event that parameters are saved.
  2. What are you changing in the symbol? location? attached record?
  3. What are you changing in the symbol? location? attached record?
  4. This is the definition of a class: "a group, set, or kind sharing common attributes" which is how it is used in VW (and computer programming) and a layer is: " a covering piece of material or a part that lies over or under another", which is also how it is used in VW. Changing VW class to layer would not represent the function accurately and would be equally confusing to the rest of us who do not use, on a regular basis, ACAD or other programs that use the term layer to assign attributes. If anyone wants to somewhat continue the same ACAD model, you can always use layer colors rather than class attributes.
  5. I believe you are missing the procedure that drives the dialog in Res:= RunLayoutDialog( ID, NIL), which most likely will give you an error. The following should get you going as you create more complicated dialogs. Procedure DialogTest; TYPE U_RECT = STRUCTURE a: REAL; b: REAL; END; VAR gRectObj: U_RECT; FUNCTION SetUpDialog(rectObj: U_RECT): LONGINT; VAR ID: LONGINT; BEGIN ID:= CreateLayout('Rect Dimensions',TRUE,'OK','Cancel'); {Text fields} CreateStaticText( ID, 05, 'Value-a', 15); CreateStaticText( ID, 06, 'Value-b', 15); {Box fields} CreateEditReal( ID, 15, 1, rectObj.a, 10); CreateEditReal( ID, 16, 1, rectObj.b, 10); {Text layout} SetFirstLayoutItem( ID, 05); SetBelowItem( ID, 05, 06, 0, 0); {Box layout} SetRightItem( ID, 05, 15, 0, 0); SetRightItem( ID, 06, 16, 0, 0); SetHelpText(ID, 1,'Click to accept values'); SetHelpText(ID, 2,'Click to cancel operation'); SetHelpText(ID, 15,'Enter width'); SetHelpText(ID, 16,'Enter height'); SetUpDialog:= ID; END; FUNCTION GetRect(VAR rectObj: U_RECT): BOOLEAN; VAR a,b: REAL; ID,dlogResult: LONGINT; PROCEDURE DriveDialog(VAR item:LONGINT; data:LONGINT); VAR i,choiceNo: INTEGER; foundName: BOOLEAN; BEGIN CASE item OF SetupDialogC: BEGIN END; 1: {OK} BEGIN IF GetEditReal(ID,15,1,a) THEN rectObj.a:= a; IF GetEditReal(ID,16,1,b) THEN rectObj.b:= b; END; 2: {Cancel} BEGIN END; END; END; BEGIN GetRect:= FALSE; ID:= SetUpDialog(rectObj); IF VerifyLayout(ID) THEN BEGIN dlogResult:= RunLayoutDialog(ID,DriveDialog); IF dlogResult = 1 THEN GetRect:= TRUE; END ELSE AlrtDialog('Cannot create the dialog'); END; BEGIN gRectObj.a:= 1.25; gRectObj.b:= 2.64; IF GetRect(gRectObj) THEN BEGIN Rect(0,0,gRectObj.a,gRectObj.b); END; END; Run(DialogTest);
  6. you can make a menu command and assign it a key shortcut in the workspace editor the command that sets the active class is: NameClass('None');
  7. I think this would be a better approximation: 16bitColor = ((8bitColor + 1)*256) - 1
  8. I am curious how would you use the app: 1. Calculate the water flow at any point inside a site? 2. Calculate the street runoff for mitigation purposes such as detention ponds inside the site or adding inlets to the public drainage system? 3. Normally this would be the job of a Licensed Civil Engineer with drainage experience. How would the app benefit you if you need to contract a licensed engineer to submit sealed and signed plans? 4. Most civil engineers use Microstation as the preferred CAD because most DOT's and local government agencies require designs in that format. Why would they use a different CAD package?
  9. Convert the plugin to a group and then you can format it as a text object. However, with the conversion you loose the Notes functionality. The purpose of the tool is to call back predefined notes which are organized in related libraries so it is useful to me because I do not have such strict formatting rules.
  10. these are lock files. it prevents others in a network from opening the same file for editing.
  11. Adrian, I commend you for your enthusiasm to advance user interest in third party products. However, my advise to you is that you should concentrate on developing applications that resolve any shortcomings in vectorworks. This could be objects, routines that provide a special function, or a collection of tools, etc. It should also be somewhat complex so that nobody else can copy your invention or that is economically not worth for others to pursue.
  12. Take a look at the following procedure for the hovering functionality: http://developer.vectorworks.net/index.php/VS:TrackObject the definition also includes a working sample.
  13. Not exactly true. The script expects the user to select the end text first, which will be appended to the second selection. This process can be extended by selecting the third string and then the first string; fourth string and then first string; and so on. The script will end when the user clicks on an empty space. I did not include any comments about this process in the script because I wrote it for personal use and knew how to use it. The script could be converted to a tool plugin, which by definition it only ends when you switch to another plugin.
  14. It seems that the naming scheme is based on a master name list for the document and consequently, you cannot name two things the same. The id workaround, which is how the class list functions, is good for the user but for the programmer, it can become a nightmare because if you are looking for a single item, you would have to search in another list with objects of the same name. In my opinion, it would be better if they separate the master list into individual name lists for all drawing objects as a group and then for each resource type.
  15. Sorry I could not reply earlier but it is a holiday here and I usually fix things around the house when I am off work. The answer as I discussed in your other post is to use ForEachObject, which is a built in loop routine that looks for objects that meet some criteria. The following will get a handle to an object with a record name 'Shape', field 'ID' = 'A1' and will change its color to red. PROCEDURE SelA1; VAR targetHdl: HANDLE; PROCEDURE ProcessObj(objHdl: HANDLE); BEGIN targetHdl:= objHdl; END; BEGIN DSelectAll; ForEachObject(ProcessObj,(('Shape'.'ID'='A1'))); IF targetHdl <> NIL THEN BEGIN SetSelect(targetHdl); SetFillBack(targetHdl, 65535, 0, 0); END; END; Run(SelA1); The following will select all objects with the record 'Shape' attached and change their color to blue. PROCEDURE SelShapes; VAR i,shpTot: INTEGER; shapeList: DYNARRAY[] OF HANDLE; PROCEDURE ProcessObjs(objHdl: HANDLE); BEGIN i:= i + 1; shapeList[i]:= objHdl; END; BEGIN shpTot:= Count(((R IN ['Shape']))); IF shpTot > 0 THEN BEGIN DSelectAll; ALLOCATE shapeList[1..shpTot]; i:= 0; ForEachObject(ProcessObjs,((R IN ['Shape']))); FOR i:= 1 TO shpTot DO BEGIN SetSelect(shapeList[i]); SetFillBack(shapeList[i], 0, 0, 65535); END; END; END; Run(SelShapes); The criteria builder should be the second menu item in the vs editor so you do not need to exit the editor for that. The test file with the scripts is attached.
  16. There is a function to create IDs if this helps, FUNCTION CreateUUID : STRING; As far as I know, there is no magical function to link objects together other than by unique attributes such as ID, color, etc. And using those known attributes to get a handle with PROCEDURE ForEachObject(callback: PROCEDURE; c: CRITERIA); The obvious way to do the linking would be to save the handle address but the way pio's work the address may change on every call.
  17. They will be moved to the third party tab only if they have been encrypted/locked. Unlocked vst (tool) files do show up in my custom tab.
  18. They will be moved to the third party tab only if they have been encrypted/locked. Unlocked vst (tool) files do show up in my custom tab.
  19. The pio will have to be event enabled to capture the parameter change in the object info palette. See Parametric State Notifications When the user changes the value in the popup menu, the pio will regenerate and it will get the parameter change notification (kParameterChangedReset) in the Reset Event. You can then change the default values for the other parameters with SetRField.
  20. Am I missing something? You should be able to do numbered notes with the General Notes Tool
  21. You need to create the extrude in one plane and then rotate about any of the x,y, or z axes to get the orientation that you want. I usually construct in the x-y plane which would look as the object was lying on the floor and then I rotate it about the x axis to orient the object as an elevation (x-z plane). It may be beneficial if you can construct the object manually in a blank file first. Then export the object as a script. The script is accurate most times and the best way to test for it is to import the script back into a blank sheet. If it looks like the original, then the code is correct.
  22. You need to create the extrude in one plane and then rotate about any of the x,y, or z axes to get the orientation that you want. I usually construct in the x-y plane which would look as the object was lying on the floor and then I rotate it about the x axis to orient the object as an elevation (x-z plane). It may be beneficial if you can construct the object manually in a blank file first. Then export the object as a script. The script is accurate most times and the best way to test for it is to import the script back into a blank sheet. If it looks like the original, then the code is correct.
  23. The definition is correct. You can only draw a 2D path on a 2D plane even if the existing view is other than the top view. The reason you are getting the error is because the 2D path can only be rotated about the axis perpendicular to the plane it is drawn. Normally, if the path is drawn on the x-y axis, then you can only rotate it about the z axis. In order to rotate it about the other axes, you will need to convert the 2D path to a 3D curve such as a 3D polygon or NURBS curve or create a 3D solid such as extrude along path.
  24. The definition is correct. You can only draw a 2D path on a 2D plane even if the existing view is other than the top view. The reason you are getting the error is because the 2D path can only be rotated about the axis perpendicular to the plane it is drawn. Normally, if the path is drawn on the x-y axis, then you can only rotate it about the z axis. In order to rotate it about the other axes, you will need to convert the 2D path to a 3D curve such as a 3D polygon or NURBS curve or create a 3D solid such as extrude along path.
  25. I believe you are missing the index number: def vs.DoMenuTextByName(subMenu, index): return None Try vs.DoMenuTextByName('Fit To Window',0)
×
×
  • Create New...