Thanks for your reply, It works and I think it should be accepted as a solution of this issue.
I still need to find out how to change the file address.
Thanks again.
Thanks for your reply, It works and I think it should be accepted as a solution of this issue.
I still need to find out how to change the file address.
Thanks again.
I guess you can use
Hi,
I am trying to get a point of an element by picking the edge of that element, but I am getting error "Object reference not set to an instance of an object."
Below is my code, can anyone help me on this?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB.Structure;
namespace Adaptive_family
{
[TransactionAttribute(TransactionMode.Manual)]
public class Points_on_curve : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
FilteredElementCollector collector = new FilteredElementCollector(doc);
try
{
Reference pickobj = uidoc.Selection.PickObject(ObjectType.Edge);
if (pickobj != null)
{
GeometryObject geo = doc.GetElement(pickobj).GetGeometryObjectFromReference(pickobj);
Curve line = geo as Curve;
XYZ pt = line.GetEndPoint(0);
}
}
catch (Exception a)
{
message = a.Message;
return Result.Failed;
}
return Result.Succeeded;
}
}
}
Thanks
M. A. Mohammed Riaz
Hi
Pickobject helps you to select an element based on point, face, edge.(i.e)Element is returned not points
To select point use PickPoint
uiDocument.Selection.PickPoint(ObjectSnapTypes, "SELECT POINT");
I hope this helps.
Hi
Thanks for your quick response.
I want to pick a edge and convert that edge in to curve, so that I can a point where ever I want like in mid or 3/4 etc,.
That's why I am trying this option, if any other option is there means please let me know.
Thanks
Hi
Sorry, I am not looking for that.
I need to select a edge of beam, then get points at some intervals to place my family at that point. Mainly this is my task looking right now.
Thanks
M. A. Mohammed Riaz
Hi
Also, try using this code
Reference R = uidoc.Selection.PickObject(ObjectType.Edge); ElementId eid = R.ElementId; Element e = doc.GetElement(eid); GeometryObject GO = e.GetGeometryObjectFromReference(R) as GeometryObject; Edge edge = GO as Edge; Curve C = edge.AsCurve();
Hi
I included some syntax from your advise in my script as below and got worked,
if (pickobj != null)
{
GeometryObject geo = doc.GetElement(pickobj).GetGeometryObjectFromReference(pickobj);
Edge edg = geo as Edge;
Curve line = edg.AsCurve();
XYZ pt = line.GetEndPoint(0);
}
Thank you a lot.
How did you create the markings?
Сan you send me a code, if it's not a secret?
Help me pleace!
Thanks!!!
Hi
Do you want to create a Tag?
check this link to create a tag
https://www.revitapidocs.com/2019/9b5a74a0-f9bd-9892-23e0-9a344f514b02.htm
If this is not what you are looking for...could you please explain in detail what you are trying to achieve?
What do you mean by marking? My code returns the conduit filter color and based off that, the code overrides the independent tag graphics to the conduit filter color if that makes any sense.
I received an email from the forum saying that Nicholas responded.
Since his response does not appear here, I assume something went wrong with the post, so I am adding it for him:
@naveen.kumar.t @jeremytammik Sorry for not being clear at the beginning, I was referring to the namespace inside of the RevitNodes.dll and the ProtoGeometry.dll. I am wondering if there exists documentation for them like in the Revit API:
By the way @jeremytammik great blog! I have just started to script within Revit and you have a lot of cool info, thanks for sharing your knowledge with the community. At the moment I am developing some Zero Touch Nodes, and it is very interesting to see how different it is than developing in the Grasshopper environment in Rhino.
Thank you for your appreciation!
I am not aware of those API assemblies. Maybe they are not intended for public use. That would explain the lack of documentation.
What's ExporterManger? I don't use it. My plugin Exception: Index out of range and don't tell me this track stack. I don't know how to solve it.
yes
Hi Jason,
Apologies for my long delay in marking your response as the solution. This is one part of a larger addin i'm trying to make so had to continue with other items before circling back to this.... it's also my first addin so it took me a long time to figure it out!
I've gotten the custom parameters working using filters. I ended up using sharedParameterElement as the extra custom parameter for my filter selection.
A few extra notes if anyone is ever trying to do the same:
I Had to create a dictionary of storage vs. parameter types for the typeOfStorage() lookup. This is certainly not the correct way of doing but I filtered all elements then added them to the dictionary.
Also, had to create a list of all sharedparameterelements to use as a lookup, so in the loop above to get the storage types also output all the sharedParameterElements to a List for lookup.
Once again, thanks a million for pointing me in the right direction!
Cheers,
Paul
While not exactly an API question this is semi related. What is the process for getting product specific logo svg files?
Our client is using a new plotter that uses XML files as input. I wonder is anyone knows the details of the UXML files, such a format introduction or a standard white paper? I searched for a while, then I did not get any useful information.
Thanks a lot.
James
Probably the most expedient way will be to download the pixel-based files. They are readily available. Then, vectorise them manually and save in SVG yourself. Unless, of course, you can find the SVG files directly wherever you can find the pixel-based ones. In either case, please let us know what you find out and how you end up solving this. Thank you!