Hello everyone,
I'm using the revit API to create some views (floor, ceilling and sections) wand put them on viewsheet with the following code :
dimensionsvue.Clear();
ViewSheet vs; vs = FichesSheets.Sheets(doc, fiche_locaux.nom, fiche_locaux.nomlocal, nbfeuille, Locaux.tx); iddebut = 0; idfin = FichesViews.vuescoupe.Count - 1; Viewport viewport = Viewport.Create(doc, vs.Id, FichesViews.vuescoupe[i].Id, new XYZ(fiche_locaux.PointRef[0].X + largeur / 2, fiche_locaux.PointRef[0].Y - (hauteur / 2), 0)); dimensionsvue.Add(new dimensions( viewport, Math.Abs(viewport.GetBoxOutline().MaximumPoint.X - viewport.GetBoxOutline().MinimumPoint.X), Math.Abs(viewport.GetBoxOutline().MaximumPoint.Y - viewport.GetBoxOutline().MinimumPoint.Y)));
it's working great but if I use linked project it dosn't work anymore. When debuging, it just go until Viewport.create and directly jump to getname.
I don't know why ?
Thanks for your help.
Thibaud
Thank you for your help but still not working.
What I tried last is to create a small project with few element. I tried my add-on and it worked as expected.
So I created a second empty project and I linked it to the first one and try again the plug-in. Here my code juste crashed at viewport.create.
What would help you to help me ?
Thank you
Thibaud
I just saw this error in the list of every parameters :
Outline = 'new System.Collections.Generic.Mscorlib_CollectionDebugView<Autodesk.Revit.DB.ViewSection>(FichesViews.vuescoupe).Items[0].Outline' threw an exception of type 'System.AccessViolationException' in all my section views. But I can' find from where it comes.
sorry for the double post, I can't edit my last one.
Thibaud
Hi Thibaud,
To help further, I would need more code.
If you don't show what your objects are initialised as, or what your personal functions do, the code you posted actually makes little sense. (Certainly not to an English speaker like me!)
If you're passing a document to a function, that has to be the modifiable document. You also need to pass elementIds from that document to that function. You can't mix and match, if that's what you're trying to do. And you can't modify a linked document.
To be clear though, if you cannot do what you're trying in the Revit UI, I doubt you would be able to do it using the API
Cheers,
-Matt
Can't find what you're looking for? Ask the community or share your knowledge.