Getting element coordiantes on sheet

Anonymous

Getting element coordiantes on sheet

Anonymous
Not applicable

Hey all,

I am trying to get coordinates of objects on a sheet, as oppose to coordinates of the element in the model.

 

I am generating XPS, then PNG files of the viewsheet at 150 pixels per inch. So that is my scale. From what I understand according to this post the units are in feet, however that does not seem to add up for me. Because I can see there is both a translation and scale transformation for the elements locations to align with the coordiantes from get_BoundingBox.

 

This is the sum of what coordinates I am executing:

var bounding = element.get_BoundingBox(viewSheet);
File.AppendAllText(path, $"{element.Name}, {group.Key}, {bounding?.Max.X}, {bounding?.Max.Y}, {bounding?.Min.X}, {bounding?.Min.Y}\n");

Where viewSheet is a ViewSheet  object.

 

I tried looking at viewport.get_BoundingBox(viewSheet);. But that seems to give me numbers that are too small in relation to the sift need for the elements to the right location on the sheet.

How would I get the exact location on a XPS/PDF sheet of an element?

Thanks,

0 Likes
Reply
Accepted solutions (3)
9,255 Views
29 Replies
Replies (29)

Anonymous
Not applicable

Hey @jeremytammik ,
I went over a few of your blog posts, and now over those two in particular.

What I am doing is a little different, because I am eventually trying to figure out the coordinates on an XPS file (or PDF). So I don't only need the coordinates in relation between the sheet and the viewport, but also between the sheet and the actual XPS.

I've been trying different things in the past few house using the rac_basic_sample_project.rvt plan from the example projects.

For simplify I am using the sheet A1 - Floor Plan. Which has origin at 0 and scale 1 so I know that its not a problem as described in your second link (unless if there is a difference between a Plan class and a SheetView class that I am missing).

 

I am drawing all the doors, and it seems they make a shape that resembles the door order, so I know that this gives me the door elements in some coordinates system:

 

var bounding = element.get_BoundingBox(viewSheet);

 

 

However I can't figure out which one, and then I don't know how to plug that back to the sheet.

The door values move form -50 to +180, plotbelow.

I also draw a rectangle of (viewSheet.Outline.Min.U,viewSheet.Outline.Min.V), (viewSheet.Outline.Max.U,viewSheet.Outline.Max.V). Which is -100, 100. That does not add up because there are doors further out at +180.

myplot.png

I was generally looking for coordinates that added up will pass 180 so I know all doors are included.

But all of the following values yielded number below:

 

var viewsheet_bounding = viewSheet.get_BoundingBox(viewSheet);
var outline = viewport.GetBoxOutline();
double scale = Convert.ToDouble(viewSheet.Scale);
viewSheet.Origin.X / scale;
viewSheet.Origin.Y / scale;
var viewport_bounding = viewport.get_BoundingBox(viewSheet);
viewSheet.Outline.Min.U; //  shown above in plot
viewSheet.Outline.Min.V; //  shown above in plot

 

All these give far too smaller numbers.

I also tried rac_advanced_sample_project.rvt  with similar results at the sheet E201 - Unnamed floor.

Can you point me what kind of data am I missing to do coordinate transformation, namely the translation?


(I found that the scale change is about ~3.8 for 150 DPI, I am not sure why because I don't know the units, but at least I can do that empirically there).

0 Likes

RPTHOMAS108
Mentor
Mentor

The first thing to note is that you are using rac_advanced_sample_project.rvt not the basic project since this is the only project with the named view sheet you mentioned.

 

I've included some code that plots bounding box position of doors to the sheet coords system. The transform is important even for plan views as although these usually align with the model coord system sometimes they are rotated:

 

201007a.PNG

 

The sheet coord system is from bottom left to top right. I don't know how the system in PDF/XPS is measured but a further translation may be required. It is important to note that the title block can be placed anywhere in the sheet space but when it is printed this space obviously gets truncated to the extents of the title block. Therefore the location of things relative to the title block is more relevant than the absolute sheet coords themselves.

 

This below is in VB, can easily be converted to C#.

 

 Private Shared Function GetElements(Of T As Element)(Doc As Document, Optional View As View = Nothing) As List(Of T)
        Dim FEC As FilteredElementCollector
        If View Is Nothing Then
            FEC = New FilteredElementCollector(Doc)
        Else
            FEC = New FilteredElementCollector(Doc, View.Id)
        End If
        Dim ECF As New ElementClassFilter(GetType(T))
        Dim Out As List(Of T) = FEC.WherePasses(ECF).ToElements.Cast(Of T).ToList
        Return Out
    End Function
    Private Shared Function GetElements(Doc As Document, BIC As BuiltInCategory, IsType As Boolean,
                                        Optional View As View = Nothing) As List(Of Element)
        Dim FEC As FilteredElementCollector
        If View Is Nothing Then
            FEC = New FilteredElementCollector(Doc)
        Else
            FEC = New FilteredElementCollector(Doc, View.Id)
        End If
        Dim ECF As New ElementCategoryFilter(BIC)
        Dim Out As List(Of Element)
        If IsType Then
            Out = FEC.WherePasses(ECF).WhereElementIsElementType.ToElements
        Else
            Out = FEC.WherePasses(ECF).WhereElementIsNotElementType.ToElements
        End If

        Return Out
    End Function
    Private Function TObj116(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.Cancelled Else
        Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
        Dim Doc As Document = UIDoc.Document
        Dim AcView As ViewSheet = TryCast(Doc.ActiveView, ViewSheet)
        If AcView Is Nothing Then Return Result.Cancelled Else

        Dim FEC As New FilteredElementCollector(Doc, AcView.Id)
        Dim VP_lst As List(Of Viewport) = GetElements(Of Viewport)(Doc, AcView)

        Dim TB_Lst As List(Of Element) = GetElements(Doc, BuiltInCategory.OST_TitleBlocks, False, AcView)
        If TB_Lst.Count <> 1 Then
            'We need this to be the only one in the view
            'We need to find the minimum bounding box point as that is most important for the printed sheet
            Return Result.Cancelled
        End If

        'We use these points only to relate the sheet coord system to the printed lines (offset from corner of title block)
        'i.e. title block can be located anywhere in sheet coord space but when it is printed 
        'such a coord space will be truncated to the extents of the title block
        Dim TB_Pt_min = TB_Lst(0).BoundingBox(AcView).Min
        Dim TB_Pt_max = TB_Lst(0).BoundingBox(AcView).Max
        TB_Pt_min = New XYZ(TB_Pt_min.X, TB_Pt_min.Y, 0) 'Zero Z
        TB_Pt_max = New XYZ(TB_Pt_max.X, TB_Pt_max.Y, 0) 'Zero Z
        Dim TB_TopLeft = New XYZ(TB_Pt_min.X, TB_Pt_max.Y, 0)

        Using Tx As New Transaction(Doc, "Door points on sheet")
            If Tx.Start = TransactionStatus.Started Then

                For VPi = 0 To VP_lst.Count - 1
                    Dim VPrt As Viewport = VP_lst(VPi)
                    Dim V As View = Doc.GetElement(VPrt.ViewId)
                    Dim Doors As List(Of Element) = GetElements(Doc, BuiltInCategory.OST_Doors, False, V)

                    Dim VPoln As Outline = VPrt.GetBoxOutline 'Viewport outline in Sheet coords
                    Dim Voln As BoundingBoxUV = V.Outline 'View outline
                    Dim Scale As Integer = V.Scale

                    'Transform for view coords (very important for rotated view plans set to true north etc.)
                    'completely not important when view plan is not rotated
                    Dim T As Transform = Transform.Identity
                    T.BasisX = V.RightDirection
                    T.BasisY = V.UpDirection
                    T.BasisZ = V.ViewDirection
                    T.Origin = V.Origin
                    'You can probably get this transform above from elsewhere such as cropbox. 

                    Dim Voln_cen = (Voln.Min + Voln.Max) / 2 'View outline centre
                    Dim VPcen As XYZ = (VPoln.MaximumPoint + VPoln.MinimumPoint) / 2 'Viewport centre
                    VPcen = New XYZ(VPcen.X, VPcen.Y, 0) 'Zero z

                    'Correction offset from VCen to centre of Viewport in sheet coords 
                    Dim Offset As XYZ = VPcen - New XYZ(Voln_cen.U, Voln_cen.V, 0)

                    For DRi = 0 To Doors.Count - 1
                        Dim Dr As Element = Doors(DRi)
                        Dim BB As BoundingBoxXYZ = Dr.BoundingBox(V)

                        'Location of door bounding box in sheet coords
                        Dim J1 As XYZ = T.Inverse.OfPoint(BB.Min).Multiply(1 / Scale) + Offset
                        Dim J2 As XYZ = T.Inverse.OfPoint(BB.Max).Multiply(1 / Scale) + Offset

                        'These points are plotted in the sheet coord space
                        'This may not relate to pdf space i.e. location of title block is important
                        J1.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD
                        J2.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD

                        'TODO Convert to PDF/XPS graphics space system.
                        'Use TB_pt_min & TB_pt_max & TB_TopLeft
                        'I am unsure of the coord system of XPS/PDF (graphics are sometimes plotted downwards from top left point
                        'not up from bottom right as considered above in the sheet coord system
                        'therefore need to transform into that space if applicable
                        'e.g. Y = ScreenHeight - OffsetFromBottom

                    Next
                Next

                Tx.Commit()
            End If
        End Using


    End Function

 

 

RPTHOMAS108
Mentor
Mentor
public Result TObj116(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
		{

			if (commandData.Application.ActiveUIDocument == null)
				return Result.Cancelled;
			UIDocument UIDoc = commandData.Application.ActiveUIDocument;
			Document Doc = UIDoc.Document;
			ViewSheet AcView = Doc.ActiveView as ViewSheet;
			if (AcView == null)
				return Result.Cancelled;
			List<Viewport> VP_lst = GetElements<Viewport>(Doc, AcView);

			IList<Element> TB_Lst = GetElements(Doc, BuiltInCategory.OST_TitleBlocks, false, AcView);
			if (TB_Lst.Count != 1)
			{
				//We need this to be the only one in the view
				//We need to find the minimum bounding box point as that is most important for the printed sheet
				return Result.Cancelled;
			}

			//We use these points only to relate the sheet coord system to the printed lines (offset from corner of title block)
			//i.e. title block can be located anywhere in sheet coord space but when it is printed 
			//such a coord space will be truncated to the extents of the title block
			XYZ TB_Pt_min = TB_Lst[0].get_BoundingBox(AcView).Min;
			XYZ TB_Pt_max = TB_Lst[0].get_BoundingBox(AcView).Max;
			TB_Pt_min = new XYZ(TB_Pt_min.X, TB_Pt_min.Y, 0);
			//Zero Z
			TB_Pt_max = new XYZ(TB_Pt_max.X, TB_Pt_max.Y, 0);
			//Zero Z
			dynamic TB_TopLeft = new XYZ(TB_Pt_min.X, TB_Pt_max.Y, 0);

			using (Transaction Tx = new Transaction(Doc, "Door points on sheet"))
			{

				if (Tx.Start() == TransactionStatus.Started)
				{
					for (int VPi = 0; VPi <= VP_lst.Count - 1; VPi++)
					{
						Viewport VPrt = VP_lst[VPi];
						View V = (View)Doc.GetElement(VPrt.ViewId);
						IList<Element> Doors = GetElements(Doc, BuiltInCategory.OST_Doors, false, V);

						Outline VPoln = VPrt.GetBoxOutline();
						//Viewport outline in Sheet coords
						BoundingBoxUV Voln = V.Outline;
						//View outline
						int Scale = V.Scale;

						//Transform for view coords (very important for rotated view plans set to true north etc.)
						//completely not important when view plan is not rotated
						Transform T = Transform.Identity;
						T.BasisX = V.RightDirection;
						T.BasisY = V.UpDirection;
						T.BasisZ = V.ViewDirection;
						T.Origin = V.Origin;
						//You can probably get this transform above from elsewhere such as cropbox. 

						dynamic Voln_cen = (Voln.Min + Voln.Max) / 2;
						//View outline centre
						XYZ VPcen = (VPoln.MaximumPoint + VPoln.MinimumPoint) / 2;
						//Viewport centre
						VPcen = new XYZ(VPcen.X, VPcen.Y, 0);
						//Zero z

						//Correction offset from VCen to centre of Viewport in sheet coords 
						XYZ Offset = VPcen - new XYZ(Voln_cen.U, Voln_cen.V, 0);

						for (int DRi = 0; DRi <= Doors.Count - 1; DRi++)
						{
							Element Dr = Doors[DRi];
							BoundingBoxXYZ BB = Dr.get_BoundingBox(V);

							//Location of door bounding box in sheet coords
							XYZ J1 = T.Inverse.OfPoint(BB.Min).Multiply((Double)1 / Scale) + Offset;
							XYZ J2 = T.Inverse.OfPoint(BB.Max).Multiply((Double)1 / Scale) + Offset;

							J1 = new XYZ(J1.X, J1.Y, 0); 
							J2 = new XYZ(J2.X, J2.Y, 0);

							//These points are plotted in the sheet coord space
							//This may not relate to pdf space i.e. location of title block is important
							//J1.DrawPoint2D(Doc, 0.01);
							//EXTENSION METHOD
							//J2.DrawPoint2D(Doc, 0.01);
							//EXTENSION METHOD

							Line LN = Line.CreateBound(J1, J2);
                            Doc.Create.NewDetailCurve(AcView, LN);

                            //TODO Convert to PDF/XPS graphics space system.
                            //Use TB_pt_min & TB_pt_max & TB_TopLeft
                            //I am unsure of the coord system of XPS/PDF (graphics are sometimes plotted downwards from top left point
                            //not up from bottom right as considered above in the sheet coord system
                            //therefore need to transform into that space if applicable
                            //e.g. Y = ScreenHeight - OffsetFromBottom

                        }
					}

					Tx.Commit();
				}
			}

			return Result.Succeeded;
		}

Anonymous
Not applicable

Hey RPTHOMAS108,

 

Where I am currently stuck:
The following function is missing and I can't find it in the API so I expect you extended it:

 

 

 

J1.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD

 

 

 

I could try and run your code if you provide it. That would give me something to try out and see how I get it to work with the rest of my C sharp code.

 

 

Here is more detail:


I know a little of VB script and C#, I tend to do most of my daily stuff with Python. None the less I want to get this working end to end in any language first. Only then I will be conferrable translating between languages. Its 130+ lines I will likely make a bug without feedback from running code.

 

I have have a "hello world" program IExternalCommand.Execute compiled and working both for VB and c sharp. So pick either as long as its consistent.

Thanks for pointing out the right file and trying it out.


In answer to your notes:

 

The sheet coord system for XPS is the same as PDF, which is also boom left to top right.

Truncation might be an issue so lets try getting the drawing printed out with Revit because that would let me compare what comes out the other side and how to manipulate it to be in the right place.

 

I have managed to compile and run without the drawing function by calling it like this:

 

 

Public Class Class1
    Implements IExternalCommand
    Public Function Execute(ByVal revit As ExternalCommandData, ByRef message As String,
                                                    ByVal elements As ElementSet) As Autodesk.Revit.UI.Result _
                                                    Implements IExternalCommand.Execute

        TaskDialog.Show("Revit", "Hello World VB")

        TObj116(revit, message, elements)
        TaskDialog.Show("Revit", "VB Done")
        Return Autodesk.Revit.UI.Result.Succeeded

    End Function

 

 


I have also attached the full VB script for the class as a txt file.

0 Likes

RPTHOMAS108
Mentor
Mentor

Yes if you replace the lines in the code calling the extension method with the below then you'll get the same result as using the method.

 

I zero the Z values of the J1 and J2 points because a non-zero value is creeping in from one of the outline methods and this will not be permitted for the creation of detail lines. I then construct lines 0.02 Ft centred on the points in the X and Y directions (cross markers).

 

J1 = New XYZ(J1.X, J1.Y, 0) 'Zero Z
J2 = New XYZ(J2.X, J2.Y, 0) 'Zero Z
'Create line 0.01 ft either side of point in Basis.X and Basis.Y directions
Dim LN0 As Line = Line.CreateBound(J1 - (XYZ.BasisX * 0.01), J1 + (XYZ.BasisX * 0.01))
Dim LN1 As Line = Line.CreateBound(J1 - (XYZ.BasisY * 0.01), J1 + (XYZ.BasisY * 0.01))
Dim LN2 As Line = Line.CreateBound(J2 - (XYZ.BasisX * 0.01), J2 + (XYZ.BasisX * 0.01))
Dim LN3 As Line = Line.CreateBound(J2 - (XYZ.BasisY * 0.01), J2 + (XYZ.BasisY * 0.01))

Doc.Create.NewDetailCurve(AcView, LN0)
Doc.Create.NewDetailCurve(AcView, LN1)
Doc.Create.NewDetailCurve(AcView, LN2)
Doc.Create.NewDetailCurve(AcView, LN3)

 

 

Anonymous
Not applicable

Ok, great!
It now compile and I get these cross shapes next to doors:

I have an idea how to solve this now without making complex calculations to where the objects are in the PNG. And not knowing what is trimmed etc.

What I want to do is draw these crosses, but in a specific RGB color. That way I can create two PDFs, one with the RGB crosses, and extract the Rasta images locations. Ideally I want it to be a single pixel and not a cross, Or at least a small circle like you posted in the previous comment.

Is there any way to do that?


Attaching current code.

0 Likes

RPTHOMAS108
Mentor
Mentor

You can't draw a line that is less than the value set given by Application.ShortCurveTolerance

 

The red dots were actually the same cross markers but with thin lines turned off in the UI and they were 0.01 ft in length rather than 0.02 ft.

 

If you know the width of your sheet in pixels and you know the width of your sheet in feet then finding the location of a point can be done by proportions (e.g. similar triangles).

X_Pixels / SheetWidth_Pixels = X_Ft / SheetWidth_Ft

X_Pixels = (SheetWidth_Pixels * X_Ft)/SheetWidth_Ft

 

e.g.

512 = (1024*0.75) / 1.5

With a sheet width in pixels of 1024, a sheet width in Ft of 1.5 and an X ord in Ft as 0.75 (half the sheet width).

 

This is not overly complicated but I've lost track of what you original task is exactly? In most cases pdfs produced by Revit contain vector graphics so what is the PNG about?

 

 

0 Likes

Anonymous
Not applicable

Ok, though the most pressing thing is the color, because that would let me separate the location mark from the plan. As long as they don't overlap it should work.


PNG output is just converting the PDF to a raster image after the PDF is generated (preset DPI).

How could I change the cross markers to a color of choice set inside the code?

0 Likes

Anonymous
Not applicable

Hey RPTHOMAS108,

 

You wrote This below is in VB, can easily be converted to C#.""

Well, I got it translated, line by line, and it does not seem to work, any idea what I am missing?


@RPTHOMAS108 wrote:

The first thing to note is that you are using rac_advanced_sample_project.rvt not the basic project since this is the only project with the named view sheet you mentioned.

 

I've included some code that plots bounding box position of doors to the sheet coords system. The transform is important even for plan views as although these usually align with the model coord system sometimes they are rotated:

 

201007a.PNG

 

The sheet coord system is from bottom left to top right. I don't know how the system in PDF/XPS is measured but a further translation may be required. It is important to note that the title block can be placed anywhere in the sheet space but when it is printed this space obviously gets truncated to the extents of the title block. Therefore the location of things relative to the title block is more relevant than the absolute sheet coords themselves.

 

This below is in VB, can easily be converted to C#.

 

 

 Private Shared Function GetElements(Of T As Element)(Doc As Document, Optional View As View = Nothing) As List(Of T)
        Dim FEC As FilteredElementCollector
        If View Is Nothing Then
            FEC = New FilteredElementCollector(Doc)
        Else
            FEC = New FilteredElementCollector(Doc, View.Id)
        End If
        Dim ECF As New ElementClassFilter(GetType(T))
        Dim Out As List(Of T) = FEC.WherePasses(ECF).ToElements.Cast(Of T).ToList
        Return Out
    End Function
    Private Shared Function GetElements(Doc As Document, BIC As BuiltInCategory, IsType As Boolean,
                                        Optional View As View = Nothing) As List(Of Element)
        Dim FEC As FilteredElementCollector
        If View Is Nothing Then
            FEC = New FilteredElementCollector(Doc)
        Else
            FEC = New FilteredElementCollector(Doc, View.Id)
        End If
        Dim ECF As New ElementCategoryFilter(BIC)
        Dim Out As List(Of Element)
        If IsType Then
            Out = FEC.WherePasses(ECF).WhereElementIsElementType.ToElements
        Else
            Out = FEC.WherePasses(ECF).WhereElementIsNotElementType.ToElements
        End If

        Return Out
    End Function
    Private Function TObj116(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.Cancelled Else
        Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
        Dim Doc As Document = UIDoc.Document
        Dim AcView As ViewSheet = TryCast(Doc.ActiveView, ViewSheet)
        If AcView Is Nothing Then Return Result.Cancelled Else

        Dim FEC As New FilteredElementCollector(Doc, AcView.Id)
        Dim VP_lst As List(Of Viewport) = GetElements(Of Viewport)(Doc, AcView)

        Dim TB_Lst As List(Of Element) = GetElements(Doc, BuiltInCategory.OST_TitleBlocks, False, AcView)
        If TB_Lst.Count <> 1 Then
            'We need this to be the only one in the view
            'We need to find the minimum bounding box point as that is most important for the printed sheet
            Return Result.Cancelled
        End If

        'We use these points only to relate the sheet coord system to the printed lines (offset from corner of title block)
        'i.e. title block can be located anywhere in sheet coord space but when it is printed 
        'such a coord space will be truncated to the extents of the title block
        Dim TB_Pt_min = TB_Lst(0).BoundingBox(AcView).Min
        Dim TB_Pt_max = TB_Lst(0).BoundingBox(AcView).Max
        TB_Pt_min = New XYZ(TB_Pt_min.X, TB_Pt_min.Y, 0) 'Zero Z
        TB_Pt_max = New XYZ(TB_Pt_max.X, TB_Pt_max.Y, 0) 'Zero Z
        Dim TB_TopLeft = New XYZ(TB_Pt_min.X, TB_Pt_max.Y, 0)

        Using Tx As New Transaction(Doc, "Door points on sheet")
            If Tx.Start = TransactionStatus.Started Then

                For VPi = 0 To VP_lst.Count - 1
                    Dim VPrt As Viewport = VP_lst(VPi)
                    Dim V As View = Doc.GetElement(VPrt.ViewId)
                    Dim Doors As List(Of Element) = GetElements(Doc, BuiltInCategory.OST_Doors, False, V)

                    Dim VPoln As Outline = VPrt.GetBoxOutline 'Viewport outline in Sheet coords
                    Dim Voln As BoundingBoxUV = V.Outline 'View outline
                    Dim Scale As Integer = V.Scale

                    'Transform for view coords (very important for rotated view plans set to true north etc.)
                    'completely not important when view plan is not rotated
                    Dim T As Transform = Transform.Identity
                    T.BasisX = V.RightDirection
                    T.BasisY = V.UpDirection
                    T.BasisZ = V.ViewDirection
                    T.Origin = V.Origin
                    'You can probably get this transform above from elsewhere such as cropbox. 

                    Dim Voln_cen = (Voln.Min + Voln.Max) / 2 'View outline centre
                    Dim VPcen As XYZ = (VPoln.MaximumPoint + VPoln.MinimumPoint) / 2 'Viewport centre
                    VPcen = New XYZ(VPcen.X, VPcen.Y, 0) 'Zero z

                    'Correction offset from VCen to centre of Viewport in sheet coords 
                    Dim Offset As XYZ = VPcen - New XYZ(Voln_cen.U, Voln_cen.V, 0)

                    For DRi = 0 To Doors.Count - 1
                        Dim Dr As Element = Doors(DRi)
                        Dim BB As BoundingBoxXYZ = Dr.BoundingBox(V)

                        'Location of door bounding box in sheet coords
                        Dim J1 As XYZ = T.Inverse.OfPoint(BB.Min).Multiply(1 / Scale) + Offset
                        Dim J2 As XYZ = T.Inverse.OfPoint(BB.Max).Multiply(1 / Scale) + Offset

                        'These points are plotted in the sheet coord space
                        'This may not relate to pdf space i.e. location of title block is important
                        J1.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD
                        J2.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD

                        'TODO Convert to PDF/XPS graphics space system.
                        'Use TB_pt_min & TB_pt_max & TB_TopLeft
                        'I am unsure of the coord system of XPS/PDF (graphics are sometimes plotted downwards from top left point
                        'not up from bottom right as considered above in the sheet coord system
                        'therefore need to transform into that space if applicable
                        'e.g. Y = ScreenHeight - OffsetFromBottom

                    Next
                Next

                Tx.Commit()
            End If
        End Using


    End Function

 

 

 


 

using System;
using System.Collections.Generic;
using System.Linq;

using Autodesk.Revit.UI;
using Autodesk.Revit.DB;

namespace HelloRevit
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    class Class1 : IExternalCommand
    {
        public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
        {
            TaskDialog.Show("Revit", "Hello World C#");

            TObj116(revit, ref message, elements);
            TaskDialog.Show("Revit", "C# Done script");
            return Result.Succeeded;
        }

        private static List<T> GetElements<T>(Document doc, View view = null) where T : Element
        {
            FilteredElementCollector fec;
            if (view == null)
                fec = new FilteredElementCollector(doc);
            else
                fec = new FilteredElementCollector(doc, view.Id);
            ElementClassFilter ecf = new ElementClassFilter(typeof(T));
            List<T> outR = fec.WherePasses(ecf).ToElements().Cast<T>().ToList();
            return outR;
        }

        private static List<Element> GetElements(Document doc, BuiltInCategory bic, bool isType, View view = null)
        {
            FilteredElementCollector fec;
            if (view == null)
                fec = new FilteredElementCollector(doc);
            else
                fec = new FilteredElementCollector(doc, view.Id);
            ElementCategoryFilter ecf = new ElementCategoryFilter(bic);
            List<Element> outR;
            if (isType)
                outR = fec.WherePasses(ecf).WhereElementIsElementType().ToElements().ToList();
            else
                outR = fec.WherePasses(ecf).WhereElementIsNotElementType().ToElements().ToList();

            return outR;
        }

        private Result TObj116(ExternalCommandData commandData, ref string message, ElementSet elements)
        {

            if (commandData.Application.ActiveUIDocument == null)
                return Result.Cancelled;

            UIDocument uiDocument = commandData.Application.ActiveUIDocument;
            Document doc = uiDocument.Document;
            ViewSheet acView = doc.ActiveView as ViewSheet;
            if (acView == null)
                return Result.Cancelled;

            FilteredElementCollector fec = new FilteredElementCollector(doc, acView.Id);
            List<Viewport> vp_lst = GetElements<Viewport>(doc, acView);

            List<Element> tb_lst = GetElements(doc, BuiltInCategory.OST_TitleBlocks, false, acView);
            if (tb_lst.Count != 1)
                // We need this to be the only one in the view
                // We need to find the minimum bounding box point as that is most important for the printed sheet
                return Result.Cancelled;

            /* We use these points only to relate the sheet coord system to the printed lines (offset from corner of title block)
             * i.e. title block can be located anywhere in sheet coord space but when it is printed 
             * such a coord space will be truncated to the extents of the title block */
            var tb_pt_min = tb_lst[0].get_BoundingBox(acView).Min;
            var tb_pt_max = tb_lst[0].get_BoundingBox(acView).Max;
            tb_pt_min = new XYZ(tb_pt_min.X, tb_pt_min.Y, 0); // Zero Z
            tb_pt_max = new XYZ(tb_pt_max.X, tb_pt_max.Y, 0); // Zero Z
            var tb_TopLeft = new XYZ(tb_pt_min.X, tb_pt_max.Y, 0);

            using (Transaction tx = new Transaction(doc, "Door points on sheet"))
            {

                if (tx.Start() == TransactionStatus.Started)
                {
                    for (int vpi = 0; vpi <= vp_lst.Count - 1; vpi++)
                    {
                        Viewport vprt = vp_lst[vpi];
                        View v = (View)doc.GetElement(vprt.ViewId);
                        List<Element> doors = GetElements(doc, BuiltInCategory.OST_Doors, false, v);

                        Outline vpoln = vprt.GetBoxOutline(); // Viewport outline in Sheet coords.
                        BoundingBoxUV voln = v.Outline; // View outline.
                        int scale = v.Scale;

                        /*Transform for view coords (very important for rotated view plans set to true north etc.)
                        completely not important when view plan is not rotated*/
                        Transform t = Transform.Identity;
                        t.BasisX = v.RightDirection;
                        t.BasisY = v.UpDirection;
                        t.BasisZ = v.ViewDirection;
                        t.Origin = v.Origin;
                        // You can probably get this transform above from elsewhere such as cropbox. 

                        var voln_cen = (voln.Min + voln.Max) / 2; // View outline centre
                        XYZ vpcen = (vpoln.MaximumPoint + vpoln.MinimumPoint) / 2; // Viewport centre
                        vpcen = new XYZ(vpcen.X, vpcen.Y, 0); // Zero z

                        // Correction offset from VCen to centre of Viewport in sheet coords
                        XYZ offset = vpcen - new XYZ(voln_cen.U, voln_cen.V, 0);

                        for (int dri = 0; dri <= doors.Count - 1; dri++)
                        {
                            Element dr = doors[dri];
                            BoundingBoxXYZ bb = dr.get_BoundingBox(v);

                            // Location of door bounding box in sheet coords
                            XYZ j1 = t.Inverse.OfPoint(bb.Min).Multiply(1 / scale) + offset;
                            XYZ j2 = t.Inverse.OfPoint(bb.Max).Multiply(1 / scale) + offset;

                            // These points are plotted in the sheet coord space
                            // This may not relate to pdf space i.e. location of title block is important
                            // J1.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD
                            // J2.DrawPoint2D(Doc, 0.01) 'EXTENSION METHOD

                            j1 = new XYZ(j1.X, j1.Y, 0); // Zero Z
                            j2 = new XYZ(j2.X, j2.Y, 0); // Zero Z
                            // Create line 0.01 ft either side of point in Basis.X and Basis.Y directions
                            Line ln0 = Line.CreateBound(j1 - (XYZ.BasisX * 0.01), j1 + (XYZ.BasisX * 0.01));
                            Line ln1 = Line.CreateBound(j1 - (XYZ.BasisY * 0.01), j1 + (XYZ.BasisY * 0.01));
                            Line ln2 = Line.CreateBound(j2 - (XYZ.BasisX * 0.01), j2 + (XYZ.BasisX * 0.01));
                            Line ln3 = Line.CreateBound(j2 - (XYZ.BasisY * 0.01), j2 + (XYZ.BasisY * 0.01));

                            doc.Create.NewDetailCurve(acView, ln0);
                            doc.Create.NewDetailCurve(acView, ln1);
                            doc.Create.NewDetailCurve(acView, ln2);
                            doc.Create.NewDetailCurve(acView, ln3);

                            /*Dim gs As GraphicsStyle ' = Autodesk.Revit.DB.Arc.LineStyle As GraphicsStyle

                            gs.GraphicsStyleCategory.LineColor = New Color(250, 10, 10)


                            Autodesk.Revit.DB.CurveByPointsUtils.CreateRectangle(Doc, J1, J2)


                            TODO Convert to PDF/XPS graphics space system.
                            Use TB_pt_min & TB_pt_max & TB_TopLeft
                            I am unsure of the coord system of XPS/PDF (graphics are sometimes plotted downwards from top left point
                            not up from bottom right as considered above in the sheet coord system
                            therefore need to transform into that space if applicable
                            e.g. Y = ScreenHeight - OffsetFromBottom*/

                        }

                    }

                    tx.Commit();

                }

            }

            return Result.Succeeded;

        }

    }
}

 

0 Likes

RPTHOMAS108
Mentor
Mentor

I already converted the bulk of it to C# and that version of it worked so compare with that. Automatic converters are not that good at context e.g.

 

In VB.NET  the line:

 

Dim J1 As XYZ = T.Inverse.OfPoint(BB.Min).Multiply(1 / Scale) + Offset

 

Converts to:

 

XYZ J1 = T.Inverse.OfPoint(BB.Min).Multiply(1 / Scale) + Offset;

 

This becomes wrong due to the differences in how VB and C# divide an integer i.e. C# truncates and VB rounds it. Therefore you need to cast the Integer to a double as below:

 

XYZ J1 = T.Inverse.OfPoint(BB.Min).Multiply((Double)1 / Scale) + Offset;

 

There may be other issues but as stated start your comparisons with the C# version I converted. Other things that the converter gets wrong:

In VB there is no need to add brackets to a method with no arguments. So when this converts to C# the brackets are missing.

For indexers in C# the wrong type of brackets get passed through (round not square for some odd reason).

Lambdas and event handlers often need to be completely rewritten

Classic Linq expressions don't exist in C# so I try to use the '.' extension methods in VB as these then convert.

Xml string literals don't exist in C# so any of that will not usually convert.

 

RPTHOMAS108
Mentor
Mentor

To correct myself:

Classic LINQ expression do exist in C# but in my experience they don't convert well, by classic LINQ I mean:

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/query-expression-syntax-examples-join-...

 

0 Likes

Anonymous
Not applicable

Ok. Fixed. Works now, attached.

I have reduced though my issue to an even simpler challenge:
How do I add a mark on the sheet in a color I choose?

0 Likes

Anonymous
Not applicable
Accepted solution
0 Likes

Mustafa.Salaheldin
Collaborator
Collaborator

Thanks a lot your solution worked for me 🤗


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

Anonymous
Not applicable

Hey,
So I have been playing with this, and there seems to be an issue when the viewport is with an angle, then items are not located correctly, is there a way to determine what direction the viewport is pointing at?

Thanks,

0 Likes

Anonymous
Not applicable

It seems to be an issue when the viewport is with an angle in v.ViewDirection then the code does not work correctly.

0 Likes

Mustafa.Salaheldin
Collaborator
Collaborator

I noticed that when the view has Scope Box applied, the solution is not working properly, any ideas?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes

RPTHOMAS108
Mentor
Mentor
Accepted solution

Hello @Mustafa.Salaheldin 

 

Probably there is an additional transform required beyond what is done above. Depends for example how the applied scopebox changes or doesn't change the properties of the view such as view centre etc. I would probably look at where the points end up vs where they should be to try and understand the difference and what that is attributed to.

 

Apart from scopeboxes you can also have views rotated on sheets, so there are various things to consider in the ultimate solution.

Type a product name

______
icon-svg-close-thick

Cookie preferences

Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

May we collect and use your data?

Learn more about the Third Party Services we use and our Privacy Statement.

Strictly necessary – required for our site to work and to provide services to you

These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

Improve your experience – allows us to show you what is relevant to you

These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

Customize your advertising – permits us to offer targeted advertising to you

These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

icon-svg-close-thick

THIRD PARTY SERVICES

Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

icon-svg-hide-thick

icon-svg-show-thick

Strictly necessary – required for our site to work and to provide services to you

Qualtrics
We use Qualtrics to let you give us feedback via surveys or online forms. You may be randomly selected to participate in a survey, or you can actively decide to give us feedback. We collect data to better understand what actions you took before filling out a survey. This helps us troubleshoot issues you may have experienced. Qualtrics Privacy Policy
Akamai mPulse
We use Akamai mPulse to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Akamai mPulse Privacy Policy
Digital River
We use Digital River to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Digital River Privacy Policy
Dynatrace
We use Dynatrace to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Dynatrace Privacy Policy
Khoros
We use Khoros to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Khoros Privacy Policy
Launch Darkly
We use Launch Darkly to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Launch Darkly Privacy Policy
New Relic
We use New Relic to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. New Relic Privacy Policy
Salesforce Live Agent
We use Salesforce Live Agent to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Salesforce Live Agent Privacy Policy
Wistia
We use Wistia to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Wistia Privacy Policy
Tealium
We use Tealium to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Tealium Privacy Policy
Upsellit
We use Upsellit to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Upsellit Privacy Policy
CJ Affiliates
We use CJ Affiliates to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. CJ Affiliates Privacy Policy
Commission Factory
We use Commission Factory to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Commission Factory Privacy Policy
Google Analytics (Strictly Necessary)
We use Google Analytics (Strictly Necessary) to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Google Analytics (Strictly Necessary) Privacy Policy
Typepad Stats
We use Typepad Stats to collect data about your behaviour on our sites. This may include pages you’ve visited. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our platform to provide the most relevant content. This allows us to enhance your overall user experience. Typepad Stats Privacy Policy
Geo Targetly
We use Geo Targetly to direct website visitors to the most appropriate web page and/or serve tailored content based on their location. Geo Targetly uses the IP address of a website visitor to determine the approximate location of the visitor’s device. This helps ensure that the visitor views content in their (most likely) local language.Geo Targetly Privacy Policy
SpeedCurve
We use SpeedCurve to monitor and measure the performance of your website experience by measuring web page load times as well as the responsiveness of subsequent elements such as images, scripts, and text.SpeedCurve Privacy Policy
Qualified
Qualified is the Autodesk Live Chat agent platform. This platform provides services to allow our customers to communicate in real-time with Autodesk support. We may collect unique ID for specific browser sessions during a chat. Qualified Privacy Policy

icon-svg-hide-thick

icon-svg-show-thick

Improve your experience – allows us to show you what is relevant to you

Google Optimize
We use Google Optimize to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Google Optimize Privacy Policy
ClickTale
We use ClickTale to better understand where you may encounter difficulties with our sites. We use session recording to help us see how you interact with our sites, including any elements on our pages. Your Personally Identifiable Information is masked and is not collected. ClickTale Privacy Policy
OneSignal
We use OneSignal to deploy digital advertising on sites supported by OneSignal. Ads are based on both OneSignal data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that OneSignal has collected from you. We use the data that we provide to OneSignal to better customize your digital advertising experience and present you with more relevant ads. OneSignal Privacy Policy
Optimizely
We use Optimizely to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Optimizely Privacy Policy
Amplitude
We use Amplitude to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Amplitude Privacy Policy
Snowplow
We use Snowplow to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Snowplow Privacy Policy
UserVoice
We use UserVoice to collect data about your behaviour on our sites. This may include pages you’ve visited. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our platform to provide the most relevant content. This allows us to enhance your overall user experience. UserVoice Privacy Policy
Clearbit
Clearbit allows real-time data enrichment to provide a personalized and relevant experience to our customers. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID.Clearbit Privacy Policy
YouTube
YouTube is a video sharing platform which allows users to view and share embedded videos on our websites. YouTube provides viewership metrics on video performance. YouTube Privacy Policy

icon-svg-hide-thick

icon-svg-show-thick

Customize your advertising – permits us to offer targeted advertising to you

Adobe Analytics
We use Adobe Analytics to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, and your Autodesk ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Adobe Analytics Privacy Policy
Google Analytics (Web Analytics)
We use Google Analytics (Web Analytics) to collect data about your behavior on our sites. This may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. We use this data to measure our site performance and evaluate the ease of your online experience, so we can enhance our features. We also use advanced analytics methods to optimize your experience with email, customer support, and sales. Google Analytics (Web Analytics) Privacy Policy
AdWords
We use AdWords to deploy digital advertising on sites supported by AdWords. Ads are based on both AdWords data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that AdWords has collected from you. We use the data that we provide to AdWords to better customize your digital advertising experience and present you with more relevant ads. AdWords Privacy Policy
Marketo
We use Marketo to send you more timely and relevant email content. To do this, we collect data about your online behavior and your interaction with the emails we send. Data collected may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, email open rates, links clicked, and others. We may combine this data with data collected from other sources to offer you improved sales or customer service experiences, as well as more relevant content based on advanced analytics processing. Marketo Privacy Policy
Doubleclick
We use Doubleclick to deploy digital advertising on sites supported by Doubleclick. Ads are based on both Doubleclick data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Doubleclick has collected from you. We use the data that we provide to Doubleclick to better customize your digital advertising experience and present you with more relevant ads. Doubleclick Privacy Policy
HubSpot
We use HubSpot to send you more timely and relevant email content. To do this, we collect data about your online behavior and your interaction with the emails we send. Data collected may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, email open rates, links clicked, and others. HubSpot Privacy Policy
Twitter
We use Twitter to deploy digital advertising on sites supported by Twitter. Ads are based on both Twitter data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Twitter has collected from you. We use the data that we provide to Twitter to better customize your digital advertising experience and present you with more relevant ads. Twitter Privacy Policy
Facebook
We use Facebook to deploy digital advertising on sites supported by Facebook. Ads are based on both Facebook data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Facebook has collected from you. We use the data that we provide to Facebook to better customize your digital advertising experience and present you with more relevant ads. Facebook Privacy Policy
LinkedIn
We use LinkedIn to deploy digital advertising on sites supported by LinkedIn. Ads are based on both LinkedIn data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that LinkedIn has collected from you. We use the data that we provide to LinkedIn to better customize your digital advertising experience and present you with more relevant ads. LinkedIn Privacy Policy
Yahoo! Japan
We use Yahoo! Japan to deploy digital advertising on sites supported by Yahoo! Japan. Ads are based on both Yahoo! Japan data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Yahoo! Japan has collected from you. We use the data that we provide to Yahoo! Japan to better customize your digital advertising experience and present you with more relevant ads. Yahoo! Japan Privacy Policy
Naver
We use Naver to deploy digital advertising on sites supported by Naver. Ads are based on both Naver data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Naver has collected from you. We use the data that we provide to Naver to better customize your digital advertising experience and present you with more relevant ads. Naver Privacy Policy
Quantcast
We use Quantcast to deploy digital advertising on sites supported by Quantcast. Ads are based on both Quantcast data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Quantcast has collected from you. We use the data that we provide to Quantcast to better customize your digital advertising experience and present you with more relevant ads. Quantcast Privacy Policy
Call Tracking
We use Call Tracking to provide customized phone numbers for our campaigns. This gives you faster access to our agents and helps us more accurately evaluate our performance. We may collect data about your behavior on our sites based on the phone number provided. Call Tracking Privacy Policy
Wunderkind
We use Wunderkind to deploy digital advertising on sites supported by Wunderkind. Ads are based on both Wunderkind data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Wunderkind has collected from you. We use the data that we provide to Wunderkind to better customize your digital advertising experience and present you with more relevant ads. Wunderkind Privacy Policy
ADC Media
We use ADC Media to deploy digital advertising on sites supported by ADC Media. Ads are based on both ADC Media data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that ADC Media has collected from you. We use the data that we provide to ADC Media to better customize your digital advertising experience and present you with more relevant ads. ADC Media Privacy Policy
AgrantSEM
We use AgrantSEM to deploy digital advertising on sites supported by AgrantSEM. Ads are based on both AgrantSEM data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that AgrantSEM has collected from you. We use the data that we provide to AgrantSEM to better customize your digital advertising experience and present you with more relevant ads. AgrantSEM Privacy Policy
Bidtellect
We use Bidtellect to deploy digital advertising on sites supported by Bidtellect. Ads are based on both Bidtellect data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Bidtellect has collected from you. We use the data that we provide to Bidtellect to better customize your digital advertising experience and present you with more relevant ads. Bidtellect Privacy Policy
Bing
We use Bing to deploy digital advertising on sites supported by Bing. Ads are based on both Bing data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Bing has collected from you. We use the data that we provide to Bing to better customize your digital advertising experience and present you with more relevant ads. Bing Privacy Policy
G2Crowd
We use G2Crowd to deploy digital advertising on sites supported by G2Crowd. Ads are based on both G2Crowd data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that G2Crowd has collected from you. We use the data that we provide to G2Crowd to better customize your digital advertising experience and present you with more relevant ads. G2Crowd Privacy Policy
NMPI Display
We use NMPI Display to deploy digital advertising on sites supported by NMPI Display. Ads are based on both NMPI Display data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that NMPI Display has collected from you. We use the data that we provide to NMPI Display to better customize your digital advertising experience and present you with more relevant ads. NMPI Display Privacy Policy
VK
We use VK to deploy digital advertising on sites supported by VK. Ads are based on both VK data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that VK has collected from you. We use the data that we provide to VK to better customize your digital advertising experience and present you with more relevant ads. VK Privacy Policy
Adobe Target
We use Adobe Target to test new features on our sites and customize your experience of these features. To do this, we collect behavioral data while you’re on our sites. This data may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, your IP address or device ID, your Autodesk ID, and others. You may experience a different version of our sites based on feature testing, or view personalized content based on your visitor attributes. Adobe Target Privacy Policy
Google Analytics (Advertising)
We use Google Analytics (Advertising) to deploy digital advertising on sites supported by Google Analytics (Advertising). Ads are based on both Google Analytics (Advertising) data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Google Analytics (Advertising) has collected from you. We use the data that we provide to Google Analytics (Advertising) to better customize your digital advertising experience and present you with more relevant ads. Google Analytics (Advertising) Privacy Policy
Trendkite
We use Trendkite to deploy digital advertising on sites supported by Trendkite. Ads are based on both Trendkite data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Trendkite has collected from you. We use the data that we provide to Trendkite to better customize your digital advertising experience and present you with more relevant ads. Trendkite Privacy Policy
Hotjar
We use Hotjar to deploy digital advertising on sites supported by Hotjar. Ads are based on both Hotjar data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Hotjar has collected from you. We use the data that we provide to Hotjar to better customize your digital advertising experience and present you with more relevant ads. Hotjar Privacy Policy
6 Sense
We use 6 Sense to deploy digital advertising on sites supported by 6 Sense. Ads are based on both 6 Sense data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that 6 Sense has collected from you. We use the data that we provide to 6 Sense to better customize your digital advertising experience and present you with more relevant ads. 6 Sense Privacy Policy
Terminus
We use Terminus to deploy digital advertising on sites supported by Terminus. Ads are based on both Terminus data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that Terminus has collected from you. We use the data that we provide to Terminus to better customize your digital advertising experience and present you with more relevant ads. Terminus Privacy Policy
StackAdapt
We use StackAdapt to deploy digital advertising on sites supported by StackAdapt. Ads are based on both StackAdapt data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that StackAdapt has collected from you. We use the data that we provide to StackAdapt to better customize your digital advertising experience and present you with more relevant ads. StackAdapt Privacy Policy
The Trade Desk
We use The Trade Desk to deploy digital advertising on sites supported by The Trade Desk. Ads are based on both The Trade Desk data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that The Trade Desk has collected from you. We use the data that we provide to The Trade Desk to better customize your digital advertising experience and present you with more relevant ads. The Trade Desk Privacy Policy
RollWorks
We use RollWorks to deploy digital advertising on sites supported by RollWorks. Ads are based on both RollWorks data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. This information may be combined with data that RollWorks has collected from you. We use the data that we provide to RollWorks to better customize your digital advertising experience and present you with more relevant ads. RollWorks Privacy Policy

Are you sure you want a less customized experience?

We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

Your experience. Your choice.

We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

May we collect and use your data to tailor your experience?

Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.