you schould be able to get sdk with revit installer(in others or some thing like that ).
but if not then on this page:
http://www.revitapidocs.com/2015/
you have for 2015
Re: Anywhere to download revit 2014 & 2015 SDK and Add-in manager?
Re: Finding Exterior walls by BuildingEnvelopeAnalyzer
Hi Jinsol,
I would like to use BuildingEnvelopeAnalyzer Class to find exterior walls.
Do you have any update on this issue ?
Thanks,
How create Solid Filled Region?
Hello!
I try create Filled Region with pattern type Solid Black.
I use next code:
Dim fillRegionTypes As FilteredElementCollector = New FilteredElementCollector(doc).OfClass(GetType(FilledRegionType)) Dim myPatterns As IEnumerable(Of FilledRegionType) = From pattern In fillRegionTypes.Cast(Of FilledRegionType)() Where pattern.FamilyName.Equals("Filled region") Select pattern
But in some rvt files it's not work.
How create Solid Filled Region?
Re: How create Solid Filled Region?
Hi!
Try to find appropriate FilledRegionType with a) solid fill, b) black color.
So, you should first of all get FillPatternElement using
var fillPatternElement = (FillPatternElement)doc.GetElement(filledRegionType.FillPatternId);
Then check fillPatternElement.GetFillPattern().IsSolidFill
and the last check is for color: filledRegionType.Color.IsValid && filledRegionType.Color.Red == 0 && filledRegionType.Color.Green == 0 && filledRegionType.Color.Blue == 0
If there are no such filled region type in project, create it
How set positioning option with api for import .rcp file
Hi to all, is possible with api choose the posiont options when we want import an .rcp file?
With UI, when you select Point Of Clouds in insert menu you can choose from this option :
Center To Center
Origin To Origin
By Shared Coordinate
For my add-ins i implemented an open dialog control for choose my .rcp file. But how i can choose with api the posioning options?
Thanks in advance.
Nicola
Re: Family Instance References w/ 2018 API
Opened the family to verifiy that the reference i'm selecting is a valid reference. Tried changing it to strong, weak, center (front/back) and I get the same error message. Also tried with FamilyInstances of different families and got the same error.
Set item type before running postablecommand
I have a list of Walltypes, floortypes, columns(familysymbol), etc.
I want to be able to select a type of an item and make it active before running a postablecommand.
Is this even possible?
How can I get or set the selected elements in a linked model?
UIDocument.Selection.GetElementIds() (or set) gives me the selected elements in the current document, but how do I get the selected elements in a linked model and add linked model elements to the selection?
Re: New schedule using API but don't know how to turn off the grid lines with AP
Depending on part of schedule you can only set values for certain things (as in UI).
http://www.revitapidocs.com/2018.1/b8c8d084-835b-9bd0-1181-1506915ad484.htm
Setting graphics style of line is a bit confusing:
Need to use a subcategory of OST_Lines (understandable)
Actual class used is GraphicsStyle so you filter for one of these with a category that is a subcatergory of OST_Lines.
Once you get the single GraphicsStyle element you want then...you don't use its GraphicsStyle.ID (since that is inherited from Element).
Instead you use GraphicsStyleCategory this returns a Category and it is the ID of that category which can be used for the border styles.
The built in category IDs can be constructed directly with ElementID constructor.
There is also a wider tickbox for globally turning on and off grid lines in the ViewSchedule, not found this in the API yet but I've not really looked that hard.
Private Function ScheduleGraphics(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, _ ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Result If commandData.Application.ActiveUIDocument Is Nothing Then Return Result.Failed Else Dim IntDoc As Document = commandData.Application.ActiveUIDocument.Document If IntDoc.ActiveView.ViewType <> ViewType.Schedule Then Return Result.Cancelled Else Dim EID As ElementId = IntDoc.ActiveView.Id Dim VS As ViewSchedule = TryCast(IntDoc.GetElement(EID), ViewSchedule) Dim VisInOrd As IEnumerable(Of ScheduleFieldId) VisInOrd = From X As ScheduleFieldId In VS.Definition.GetFieldOrder Let F As ScheduleField = VS.Definition.GetField(X) Where F.IsHidden = False Select X Using TX As New Transaction(IntDoc, "Schedule") If TX.Start = TransactionStatus.Started Then Dim SF As ScheduleField = VS.Definition.GetField(VisInOrd(0)) Dim TBS As TableCellStyle = SF.GetStyle Dim OO As TableCellStyleOverrideOptions = TBS.GetCellStyleOverrideOptions OO.BorderBottomLineStyle = True TBS.BorderBottomLineStyle = ElementId.InvalidElementId OO.BorderTopLineStyle = True TBS.BorderTopLineStyle = ElementId.InvalidElementId TBS.SetCellStyleOverrideOptions(OO) SF.SetStyle(TBS) TX.Commit() End If End Using End Function
Re: Set item type before running postablecommand
Dear kevin,
Could you explain why you want to do this? Which postablecommand do you want to invoke?
For Family Symbol, there does exist a method named "Active", but I think that is not what you want.
Actually, if you want to create a wall through a wall type, I think you can directly use Wall.Create method, no need to use PostableCommand.
Re: IndependentTag - How do i call this in Revit?
Dear chrishildebran,
Please see codes below, it can work now.
Please pay attention to following items:
1. if your codes will modify the document, put them in a transaction
2. make sure you have loaded the tags
3. you can debug your codes in VS
[Transaction(TransactionMode.Manual)] public class Tagtest : IExternalCommand { #region Methods /// <summary> /// The CreateIndependentTag /// </summary> /// <param name="document">The <see cref="Document" /></param> /// <param name="wall">The <see cref="Wall" /></param> /// <returns>The <see cref="IndependentTag" /></returns> public IndependentTag CreateIndependentTag(Document document, Wall wall) { TaskDialog.Show("Create Independent Tag Method", "Start Of Method Dialog"); // make sure active view is not a 3D view var view = document.ActiveView; // define tag mode and tag orientation for new tag var tagMode = TagMode.TM_ADDBY_CATEGORY; var tagorn = TagOrientation.Horizontal; // Add the tag to the middle of the wall var wallLoc = wall.Location as LocationCurve; var wallStart = wallLoc.Curve.GetEndPoint(0); var wallEnd = wallLoc.Curve.GetEndPoint(1); var wallMid = wallLoc.Curve.Evaluate(0.5, true); var wallRef = new Reference(wall); var newTag = IndependentTag.Create(document, view.Id, wallRef, true, tagMode, tagorn, wallMid); if (null == newTag) throw new Exception("Create IndependentTag Failed."); // newTag.TagText is read-only, so we change the Type Mark type parameter to // set the tag text. The label parameter for the tag family determines // what type parameter is used for the tag text. var type = wall.WallType; var foundParameter = type.LookupParameter("Type Mark"); //var result = foundParameter.Set("Hello"); // set leader mode free // otherwise leader end point move with elbow point newTag.LeaderEndCondition = LeaderEndCondition.Free; var elbowPnt = wallMid + new XYZ(5.0, 5.0, 0.0); newTag.LeaderElbow = elbowPnt; var headerPnt = wallMid + new XYZ(10.0, 10.0, 0.0); newTag.TagHeadPosition = headerPnt; TaskDialog.Show("Create Independent Tag Method", "End Of Method Dialog"); return newTag; } public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; try { Reference r = uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element); Wall w = doc.GetElement(r.ElementId) as Wall; using (Transaction t = new Transaction(doc, "create tag")) { t.Start(); CreateIndependentTag(doc, w); t.Commit(); } } catch(Exception e) { message = e.Message; return Result.Failed; } return Result.Succeeded; } #endregion }
a
Re: How can I get or set the selected elements in a linked model?
Document doclink = null;
Reference refelmlinked = uidoc.Selection.PickObject(ObjectType.LinkedElement, "pick an element in the linked model");
Element e = doclink.GetElement(refelmlinked.LinkedElementId);
Re: How can I get or set the selected elements in a linked model?
Thanks for the reply! That works if you're having the user pick objects, but for my use case I can't do that -- I need to read and write the current selection. Any idea there? I'm not sure it's possible in the API based on what I've read in other posts here.
Re: How create Solid Filled Region?
Thanks! All work!
Re: Is it possible to Change Revit Link to Linked View from the API
As far as I know this hasn't been exposed in the API currently.
Sorry...
Re: Set item type before running postablecommand
Hi,
did you try:
Document.SetDefaultElementTypeId(ElementTypeGroup.WallType, yourWallType.Id);
Document.SetDefaultElementTypeId(ElementTypeGroup.FloorType, yourFloorType.Id);
Analogously, there is a
Document.SetDefaultFamilyTypeId method.
Revitalizer
Re: Family with parametric array
Hi Eason,
Find below the first problem that we faced when we add a constrained box (dimensions, reference lines and a extrusion ) to the array.
1. A short exact description of what you are trying to achieve.
I'm trying to copy a constrained box in an array. This way, anytime that I change the width or height of the box, the duplicated boxes will also change their dimensions.
2. The behavior you observe versus what you expect, and why this is a problem.
I get the following message when the function Commit() is called:
I expect that the array is created correctly and I can modify the number of copies of the initial box using the parameter table.
3. A complete yet minimal Revit sample model to run a test in.
4. A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyze its behavior live in the sample model.
Find attached a simple Revit plugin which reproduces the issue.
5. Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
- Run Revit
- Go to "Add-Ins" tab
- Expand "External Tools" button and select "Command ArrayParametric"
- Error - Cannot be ignored: "Changes to groups are allowed only in group edit mode. Use the Edit Group command to change to all instances of a group type. You may use the "Ungroup" option to proceed with this change by ungrouping the changed group instances."
Another question would be if it is possible to constraint the translation vector of that array programmatically?
Thanks in advance,
Re: How create arrow settings?
Mustafa.Salaheldin wrote:As far as I know there is now way through the Revit API. The closest approach is to create a SlideOut using AddSlideOut method.
I was clear on that. You can't add arrow via API, but as an alternative you can use the slide out.
Re: How set positioning option with api for import .rcp file
I found in sdk samples how to do this option on DWGfile import case. In this case API have an object "DWGImportOptions" where i can set Placement settings. But in case of PointCloud how i can to apply? i don't found a similar object in API.. is possible that in API PointCloud dosen't exist an similar property?
Thanks in advance,
Nicola
PickPoint with template
Hey,
I'm working on a tool in C3 using the Revit API. I ask the user to select a point and that point will be used (later) to place different object.
Is there a way tho show a template around the "prompt point" when using "Selection.PickPoint("Pick up a point...");" like a box around (see paint picture ^^)?
Thank you !
Thibaud