Hello, I am working on a project using the VisualArq API (C#), and have been slowly getting a grasp on how it is used. I am running into an issue when creating a new window with a custom style…
//Create a profile from a rectangle VA.CurveProfileSize curveProfileSize = new VA.CurveProfileSize(); curveProfileSize.OuterCurve = new Rectangle3d(Plane.WorldZX, 5.0, 8.0).ToNurbsCurve(); Guid profileTemplateID = VA.AddCurveProfileTemplate("TestStyle", curveProfileSize); //Create a style and a profile Guid styleId = VA.AddWindowStyle("TestWindowStyle", profileTemplateID); Guid profileId = VA.AddCurveProfileTemplate("TestCurveProfileTemplate", curveProfileSize); //Assign the profile to the style VA.SetOpeningStyleProfileTemplate(styleId, profileId); //Add a window using the new style Guid openingId = VA.AddWindow(styleId, new Point3d(0,20,0), 0.0);
The error is thrown on the VA.AddWindow(), as “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”
What does work is calling VA.GetAllWindowStyleIds(), and getting the 0th element (the supposed default one), which works. That would be VA.AddWindow(VA.GetAllWindowStyleIds(), new Point3d(0,20,0), 0.0);
This is just a portion of some test code that is placing the window on a wall that exists between points (0,0,0), and (0,100,0)
Update: Adding a style this way shows in both the vaWindowStyles command window, and in the properties panel, yet when assigning a default-style created window to the new style, the same “Attempted to read or write…” error occurs.
Version: RhinoCommon 7.6.21127.19001
Language: C# using VisualStudio