<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: NewSpotCoordinate in python in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9114018#M39012</link>
    <description>&lt;P&gt;Thank for your quick reply,&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917" target="_self"&gt;jeremytammik&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But, I want to use&amp;nbsp;'NewSpotCoordinate' method.... not 'NewS&lt;SPAN&gt;potElevation' method....!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is they the same function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2019 08:08:14 GMT</pubDate>
    <dc:creator>Ysuuny</dc:creator>
    <dc:date>2019-10-29T08:08:14Z</dc:date>
    <item>
      <title>NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9111600#M39007</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    @classmethod  
    def Make_NewSpotCoordinate(cls, points, face):    
      
        ref = face
        
        print('View', __revit__.ActiveUIDocument.ActiveView)
        print('Face', face)

        hasleader = True

        for point in points:
            pointX = point[0]
            pointY = point[1]
            pointZ = point[2]
            
            bend = revit_xyz(pointX + 450, pointY + 450, pointZ) # temp
            end = revit_xyz(pointX+500, pointY+500, pointZ) # temp 
            tempArr = revit_xyz(pointX, pointY, pointZ)
            
            print('Point', point)            
            print('Bend', bend)
            print('End', end)            
            print('TempArr', tempArr)
            print('HasLeader', type(hasleader))
            print('===test==', __revit__.ActiveUIDocument.ActiveView.Document)&lt;BR /&gt;
            try:
                #Document.NewSpotCoordinate(revit.active_view, ref, point, bend, end, tempArr, hasleader) # E1) NewSpotCoordinate() takes exactly 8 arguments (7 given)    
                c_doc.NewSpotCoordinate(__revit__.ActiveUIDocument.ActiveView , revit.active_view , ref, point, bend, end, tempArr, hasleader) # E2)  'expected Document, got Document
          
            except Exception as ex:
                print('Exception : ', ex)&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;▲The above code is part of the code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Guys,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm trying to use the 'NewSpotCoordinate' function in python, but there's an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;First, I used this code&amp;nbsp;'Document.NewSpotCoordinate(revit.active_view, ref, point, bend, end, tempArr, hasleader)'&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, an error with the contents 'NewSpotCoordinate() takes exactly 8 arguments (7 given)'&amp;nbsp; occurred.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I put anything in to make eight parameters.&amp;nbsp;an error with the contents&amp;nbsp; 'expected Document, got&amp;nbsp; 000 '.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Finally, I put 'document type' in first param.&amp;nbsp;So the error that came out was 'expected Document, got Document'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do I have to use the 'Transaction' Class?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I really don't know...... What did I miss?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;▼ The following is the contents of the output.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;('View', &amp;lt;Autodesk.Revit.DB.View3D object at 0x000000000000044B [Autodesk.Revit.DB.View3D]&amp;gt;)
('Face', &amp;lt;Autodesk.Revit.DB.Reference object at 0x000000000000044C [Autodesk.Revit.DB.Reference]&amp;gt;)
('Point', &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044D [(-11195.841918861, -14411.389384324, 23143.876630295)]&amp;gt;)
('Bend', &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044E [(-10745.841918861, -13961.389384324, 23143.876630295)]&amp;gt;)
('End', &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044F [(-10695.841918861, -13911.389384324, 23143.876630295)]&amp;gt;)
('TempArr', &amp;lt;Autodesk.Revit.DB.XYZ object at 0x0000000000000450 [(-11195.841918861, -14411.389384324, 23143.876630295)]&amp;gt;)
('HasLeader', &amp;lt;type 'bool'&amp;gt;)
('===test==', &amp;lt;Autodesk.Revit.DB.Document object at 0x0000000000000451 [Autodesk.Revit.DB.Document]&amp;gt;)
('Exception : ', TypeError('expected Document, got Document',))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The translation can be strange......!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Have a nice day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 05:38:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9111600#M39007</guid>
      <dc:creator>Ysuuny</dc:creator>
      <dc:date>2019-10-28T05:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9111782#M39008</link>
      <description>&lt;P&gt;First: yes, you definitely have to wrap this in a transaction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to wrap any and all database modifications in a transaction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly: watch out! The Revit API defines two different document classes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Autodesk.Revit.Creation.Document&lt;/LI&gt;
&lt;LI&gt;Autodesk.Revit.DB.Document&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hence, the weird error message.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;NewSpotCoordinate method belongs to the former:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2020/c2efc79c-75ff-4505-ef3d-3db94a952227.htm" target="_blank"&gt;https://www.revitapidocs.com/2020/c2efc79c-75ff-4505-ef3d-3db94a952227.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, all should be clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 08:19:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9111782#M39008</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-10-28T08:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9113675#M39009</link>
      <description>&lt;P&gt;Thank for your quick reply.&lt;BR /&gt;I was already using 'Autodesk.Revit.Creation.Document / NewSpotCoordinate'.&lt;BR /&gt;c_doc is 'from Autodesk.Revit.Creation import Document as c_doc' alias.&lt;BR /&gt;And I'm try to transation class but I keep getting errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q1) What is the relationship between view3d and view class?&lt;BR /&gt;Q2) Is it okay if view3d goes into the first parameter?&lt;BR /&gt;Q3) Is the use of transation class(method) correct?&lt;/P&gt;&lt;P&gt;Q4) ......Also What did I miss?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;from Autodesk.Revit.DB import Document 
from Autodesk.Revit.DB import Face 
from Autodesk.Revit.DB import XYZ as revit_xyz
from Autodesk.Revit.Creation import Document as c_doc
from Autodesk.Revit.DB import View as view
from Autodesk.Revit.UI import UIDocument as r_ui
from Autodesk.Revit.DB import Reference as r_ref
from Autodesk.Revit.UI import UIApplication as r_uiapp
from Autodesk.Revit.DB import Transaction&lt;/PRE&gt;&lt;P&gt;▲ Define the class and alias&lt;/P&gt;&lt;PRE&gt;    @classmethod  
    def Make_NewSpotCoordinate(cls, points, face):    
        document = __revit__.ActiveUIDocument.Document
        app = __revit__.Application;
        ref = face
        hasleader = True

        transV = Transaction(__revit__.ActiveUIDocument.Document, 'NewSpotCoordinate')
        transV.Start("new spot coordinate")

        try:    
            for point in points:
                pointX = point[0]
                pointY = point[1]
                pointZ = point[2]
                
                bend = revit_xyz(pointX + 450, pointY + 450, pointZ) # temp
                end = revit_xyz(pointX+500, pointY+500, pointZ) # temp 
                tempArr = revit_xyz(pointX, pointY, pointZ)
                
                c_doc.NewSpotCoordinate( revit.active_view , ref, point, bend, end, tempArr, hasleader)
        except Exception as ex:
            print('Error: ' , ex )
        finally:
            transV.Commit()      &lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;▲The above code is part of the code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;View / &amp;lt;Autodesk.Revit.DB.View3D object at 0x000000000000044B [Autodesk.Revit.DB.View3D]&amp;gt;
Face(reference) / &amp;lt;Autodesk.Revit.DB.Reference object at 0x000000000000044C [Autodesk.Revit.DB.Reference]&amp;gt;
Point(origin) / &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044D [(-11195.841918861, -14411.389384324, 23143.876630295)]&amp;gt;
Bend / &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044E [(-10745.841918861, -13961.389384324, 23143.876630295)]&amp;gt;
End / &amp;lt;Autodesk.Revit.DB.XYZ object at 0x000000000000044F [(-10695.841918861, -13911.389384324, 23143.876630295)]&amp;gt;
TempArr(refPt) / &amp;lt;Autodesk.Revit.DB.XYZ object at 0x0000000000000450 [(-11195.841918861, -14411.389384324, 23143.876630295)]&amp;gt;
HasLeader /  &amp;lt;type 'bool'&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;▲ Each parameter type&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Result(Error) :&amp;nbsp;&lt;/SPAN&gt;TypeError('NewSpotCoordinate() takes exactly 8 arguments (7 given)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* The translation can be strange &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 02:01:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9113675#M39009</guid>
      <dc:creator>Ysuuny</dc:creator>
      <dc:date>2019-10-29T02:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9113945#M39010</link>
      <description>&lt;P&gt;Q1) What is the relationship between view3d and view class?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;View3D is derived from View.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Q2) Is it okay if view3d goes into the first parameter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Q3) Is the use of transation class(method) correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks fine to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q4) ......Also What did I miss?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There was a recent issue on converting a Revit API document to a wrapped object for a zero touch node:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2019/08/zero-touch-node-element-wrapper-and-load-from-stream.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2019/08/zero-touch-node-element-wrapper-and-load-from-stream.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need to wrap something somewhere?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 07:21:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9113945#M39010</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-10-29T07:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9114000#M39011</link>
      <description>&lt;P&gt;Maybe you cannot create a spot elevation in a 3D view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you must be in an elevation view, like in this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2010/01/spot-elevation-creation-on-top-of-beam.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://thebuildingcoder.typepad.com/blog/2010/01/spot-elevation-creation-on-top-of-beam.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should always test that what you are trying to do is possible at all in the user interface before trying to attack it programmatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 07:56:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9114000#M39011</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-10-29T07:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: NewSpotCoordinate in python</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9114018#M39012</link>
      <description>&lt;P&gt;Thank for your quick reply,&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917" target="_self"&gt;jeremytammik&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But, I want to use&amp;nbsp;'NewSpotCoordinate' method.... not 'NewS&lt;SPAN&gt;potElevation' method....!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is they the same function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 08:08:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/newspotcoordinate-in-python/m-p/9114018#M39012</guid>
      <dc:creator>Ysuuny</dc:creator>
      <dc:date>2019-10-29T08:08:14Z</dc:date>
    </item>
  </channel>
</rss>

