<?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: How to use function &amp;quot;SetUcs&amp;quot; in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342838#M84810</link>
    <description>Hi Albert:&lt;BR /&gt;
Can you give me some sample codes about how to do it?&lt;BR /&gt;
Regards.&lt;BR /&gt;
John Jiang</description>
    <pubDate>Mon, 06 Jun 2005 08:39:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-06-06T08:39:25Z</dc:date>
    <item>
      <title>How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342832#M84804</link>
      <description>Dim orthoView As New OrthographicView&lt;BR /&gt;
            Dim viewp As New Viewport&lt;BR /&gt;
            orthoView = OrthographicView.FrontView&lt;BR /&gt;
            viewp.SetUcs(orthoView)    '''''''why not working???&lt;BR /&gt;
            viewp.UpdateDisplay()&lt;BR /&gt;
            btr.AppendEntity(viewp)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(viewp, True)</description>
      <pubDate>Thu, 02 Jun 2005 05:38:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342832#M84804</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-02T05:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342833#M84805</link>
      <description>Try setting the ucs after you added viewport to the drawing.&lt;BR /&gt;
If that doesn't work please try to post some code that I can cut and paste &lt;BR /&gt;
and compile (no dependencies on other stuff).&lt;BR /&gt;
&lt;BR /&gt;
Albert&lt;BR /&gt;
&lt;BR /&gt;
&lt;JIANGFANGJI&gt; wrote in message news:4862874@discussion.autodesk.com...&lt;BR /&gt;
Dim orthoView As New OrthographicView&lt;BR /&gt;
            Dim viewp As New Viewport&lt;BR /&gt;
            orthoView = OrthographicView.FrontView&lt;BR /&gt;
            viewp.SetUcs(orthoView)    '''''''why not working???&lt;BR /&gt;
            viewp.UpdateDisplay()&lt;BR /&gt;
            btr.AppendEntity(viewp)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(viewp, True)&lt;/JIANGFANGJI&gt;</description>
      <pubDate>Thu, 02 Jun 2005 15:28:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342833#M84805</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-02T15:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342834#M84806</link>
      <description>Hi Albert: &lt;BR /&gt;
Following is the complete codes that you can compile.Please help me to find the reason why the function "SetUCS" don't work!&lt;BR /&gt;
&lt;BR /&gt;
 Private Sub btnDraw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDraw.Click&lt;BR /&gt;
&lt;BR /&gt;
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database&lt;BR /&gt;
        Dim tm As DBTransMan = db.TransactionManager&lt;BR /&gt;
        Dim ta As Transaction = tm.StartTransaction&lt;BR /&gt;
&lt;BR /&gt;
        Try&lt;BR /&gt;
            Dim r, w, v, h As Double&lt;BR /&gt;
            Dim x0, y0, z0, x1, y1, z1 As Double&lt;BR /&gt;
            Dim tt, n As Integer&lt;BR /&gt;
            Dim cenX0, cenY0, cenZ0 As Double&lt;BR /&gt;
            Dim p0, p1 As Point3d&lt;BR /&gt;
            Dim p1Collection As New Point3dCollection&lt;BR /&gt;
            Dim sPline As Polyline3d&lt;BR /&gt;
            Const pi = 3.1415926&lt;BR /&gt;
&lt;BR /&gt;
            n = CInt(txtN.Text)&lt;BR /&gt;
            cenX0 = CDbl(txtX.Text)&lt;BR /&gt;
            cenY0 = CDbl(txtY.Text)&lt;BR /&gt;
            cenZ0 = CDbl(txtZ.Text)&lt;BR /&gt;
&lt;BR /&gt;
            tt = 0&lt;BR /&gt;
            r = CDbl(txtRadius.Text)&lt;BR /&gt;
            h = CDbl(txtDaoCheng.Text)&lt;BR /&gt;
&lt;BR /&gt;
            Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)&lt;BR /&gt;
            Dim btr As BlockTableRecord = tm.GetObject(bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
            w = 2 * pi / 180&lt;BR /&gt;
            v = h / 180&lt;BR /&gt;
&lt;BR /&gt;
            x0 = cenX0 + r * Cos(w * tt)&lt;BR /&gt;
            y0 = cenY0 + r * Sin(w * tt)&lt;BR /&gt;
            z0 = cenZ0 + v * tt&lt;BR /&gt;
            p0 = New Point3d(x0, y0, z0)&lt;BR /&gt;
            p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
            p1Collection.Add(p1)&lt;BR /&gt;
&lt;BR /&gt;
            tt = tt + 1&lt;BR /&gt;
&lt;BR /&gt;
            Do While (tt &amp;lt;= (n * 180))&lt;BR /&gt;
                x0 = cenX0 + r * Cos(w * tt)&lt;BR /&gt;
                y0 = cenY0 + r * Sin(w * tt)&lt;BR /&gt;
                z0 = cenZ0 + v * tt&lt;BR /&gt;
                p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
&lt;BR /&gt;
                p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
                p1Collection.Add(p1)&lt;BR /&gt;
                tt = tt + 1&lt;BR /&gt;
            Loop&lt;BR /&gt;
&lt;BR /&gt;
            sPline = New Polyline3d(Poly3dType.SimplePoly, p1Collection, False)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(sPline)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(sPline, True)&lt;BR /&gt;
&lt;BR /&gt;
            '''''''''Draw Screw Solid '''''''''''''''''''''''''''''''''&lt;BR /&gt;
&lt;BR /&gt;
            Dim dboCol As New DBObjectCollection&lt;BR /&gt;
            Dim cir As New Circle&lt;BR /&gt;
            Dim solid3dScrew As New Solid3d&lt;BR /&gt;
            Dim regionCir As Region&lt;BR /&gt;
            Dim regions As DBObjectCollection&lt;BR /&gt;
''''''''''''''''''''''''''''''UCS should be changed to FrontView from TopView,But the SetUCS can not goog work!!!!!!!!!!&lt;BR /&gt;
            Dim orthoView As New OrthographicView&lt;BR /&gt;
            Dim viewp As New Viewport&lt;BR /&gt;
            orthoView = OrthographicView.FrontView&lt;BR /&gt;
            viewp.SetUcs(orthoView)&lt;BR /&gt;
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&lt;BR /&gt;
            cir.Center = p0&lt;BR /&gt;
            cir.Radius = 10&lt;BR /&gt;
            dboCol.Clear()&lt;BR /&gt;
            dboCol.Add(cir)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(cir)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(cir, True)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
            regions = regionCir.CreateFromCurves(dboCol)&lt;BR /&gt;
            regionCir = regions(0)&lt;BR /&gt;
&lt;BR /&gt;
            'solid3dScrew.ExtrudeAlongPath(regionCir, sPline, 0)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(solid3dScrew)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(solid3dScrew, True)&lt;BR /&gt;
            regions.Dispose()&lt;BR /&gt;
            '''''''''Draw Screw Solid '''''''''''''''''''''''''''''''''&lt;BR /&gt;
&lt;BR /&gt;
            ta.Commit()&lt;BR /&gt;
        Catch&lt;BR /&gt;
            MsgBox( Err.Description, MsgBoxStyle.Critical, "Error")&lt;BR /&gt;
        Finally&lt;BR /&gt;
            ta.Dispose()&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub</description>
      <pubDate>Fri, 03 Jun 2005 00:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342834#M84806</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-03T00:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342835#M84807</link>
      <description>Ok. What are you trying to do? Let me rephrase in english what you are &lt;BR /&gt;
doing:&lt;BR /&gt;
1. You create a new viewport&lt;BR /&gt;
2. You set the UCS in the viewport.&lt;BR /&gt;
&lt;BR /&gt;
Note that you never add the viewport to the drawing and you never set any of &lt;BR /&gt;
the view properties so it is unclear what this viewport is supposed to view.&lt;BR /&gt;
&lt;BR /&gt;
I suspect that you want to set the ucs in the current viewport. Is that it?&lt;BR /&gt;
&lt;BR /&gt;
Albert&lt;BR /&gt;
&lt;JIANGFANGJI&gt; wrote in message news:4864232@discussion.autodesk.com...&lt;BR /&gt;
Hi Albert:&lt;BR /&gt;
Following is the complete codes that you can compile.Please help me to find &lt;BR /&gt;
the reason why the function "SetUCS" don't work!&lt;BR /&gt;
&lt;BR /&gt;
 Private Sub btnDraw_Click(ByVal sender As System.Object, ByVal e As &lt;BR /&gt;
System.EventArgs) Handles btnDraw.Click&lt;BR /&gt;
&lt;BR /&gt;
        Dim db As Database = &lt;BR /&gt;
Application.DocumentManager.MdiActiveDocument.Database&lt;BR /&gt;
        Dim tm As DBTransMan = db.TransactionManager&lt;BR /&gt;
        Dim ta As Transaction = tm.StartTransaction&lt;BR /&gt;
&lt;BR /&gt;
        Try&lt;BR /&gt;
            Dim r, w, v, h As Double&lt;BR /&gt;
            Dim x0, y0, z0, x1, y1, z1 As Double&lt;BR /&gt;
            Dim tt, n As Integer&lt;BR /&gt;
            Dim cenX0, cenY0, cenZ0 As Double&lt;BR /&gt;
            Dim p0, p1 As Point3d&lt;BR /&gt;
            Dim p1Collection As New Point3dCollection&lt;BR /&gt;
            Dim sPline As Polyline3d&lt;BR /&gt;
            Const pi = 3.1415926&lt;BR /&gt;
&lt;BR /&gt;
            n = CInt(txtN.Text)&lt;BR /&gt;
            cenX0 = CDbl(txtX.Text)&lt;BR /&gt;
            cenY0 = CDbl(txtY.Text)&lt;BR /&gt;
            cenZ0 = CDbl(txtZ.Text)&lt;BR /&gt;
&lt;BR /&gt;
            tt = 0&lt;BR /&gt;
            r = CDbl(txtRadius.Text)&lt;BR /&gt;
            h = CDbl(txtDaoCheng.Text)&lt;BR /&gt;
&lt;BR /&gt;
            Dim bt As BlockTable = tm.GetObject(db.BlockTableId, &lt;BR /&gt;
OpenMode.ForRead, False)&lt;BR /&gt;
            Dim btr As BlockTableRecord = &lt;BR /&gt;
tm.GetObject(bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
            w = 2 * pi / 180&lt;BR /&gt;
            v = h / 180&lt;BR /&gt;
&lt;BR /&gt;
            x0 = cenX0 + r * Cos(w * tt)&lt;BR /&gt;
            y0 = cenY0 + r * Sin(w * tt)&lt;BR /&gt;
            z0 = cenZ0 + v * tt&lt;BR /&gt;
            p0 = New Point3d(x0, y0, z0)&lt;BR /&gt;
            p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
            p1Collection.Add(p1)&lt;BR /&gt;
&lt;BR /&gt;
            tt = tt + 1&lt;BR /&gt;
&lt;BR /&gt;
            Do While (tt &amp;lt;= (n * 180))&lt;BR /&gt;
                x0 = cenX0 + r * Cos(w * tt)&lt;BR /&gt;
                y0 = cenY0 + r * Sin(w * tt)&lt;BR /&gt;
                z0 = cenZ0 + v * tt&lt;BR /&gt;
                p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
&lt;BR /&gt;
                p1 = New Point3d(x0, y0, z0)&lt;BR /&gt;
                p1Collection.Add(p1)&lt;BR /&gt;
                tt = tt + 1&lt;BR /&gt;
            Loop&lt;BR /&gt;
&lt;BR /&gt;
            sPline = New Polyline3d(Poly3dType.SimplePoly, p1Collection, &lt;BR /&gt;
False)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(sPline)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(sPline, True)&lt;BR /&gt;
&lt;BR /&gt;
            '''''''''Draw Screw Solid '''''''''''''''''''''''''''''''''&lt;BR /&gt;
&lt;BR /&gt;
            Dim dboCol As New DBObjectCollection&lt;BR /&gt;
            Dim cir As New Circle&lt;BR /&gt;
            Dim solid3dScrew As New Solid3d&lt;BR /&gt;
            Dim regionCir As Region&lt;BR /&gt;
            Dim regions As DBObjectCollection&lt;BR /&gt;
''''''''''''''''''''''''''''''UCS should be changed to FrontView from &lt;BR /&gt;
TopView,But the SetUCS can not goog work!!!!!!!!!!&lt;BR /&gt;
            Dim orthoView As New OrthographicView&lt;BR /&gt;
            Dim viewp As New Viewport&lt;BR /&gt;
            orthoView = OrthographicView.FrontView&lt;BR /&gt;
            viewp.SetUcs(orthoView)&lt;BR /&gt;
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&lt;BR /&gt;
            cir.Center = p0&lt;BR /&gt;
            cir.Radius = 10&lt;BR /&gt;
            dboCol.Clear()&lt;BR /&gt;
            dboCol.Add(cir)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(cir)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(cir, True)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
            regions = regionCir.CreateFromCurves(dboCol)&lt;BR /&gt;
            regionCir = regions(0)&lt;BR /&gt;
&lt;BR /&gt;
            'solid3dScrew.ExtrudeAlongPath(regionCir, sPline, 0)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(solid3dScrew)&lt;BR /&gt;
            tm.AddNewlyCreatedDBObject(solid3dScrew, True)&lt;BR /&gt;
            regions.Dispose()&lt;BR /&gt;
            '''''''''Draw Screw Solid '''''''''''''''''''''''''''''''''&lt;BR /&gt;
&lt;BR /&gt;
            ta.Commit()&lt;BR /&gt;
        Catch&lt;BR /&gt;
            MsgBox( Err.Description, MsgBoxStyle.Critical, "Error")&lt;BR /&gt;
        Finally&lt;BR /&gt;
            ta.Dispose()&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;/JIANGFANGJI&gt;</description>
      <pubDate>Fri, 03 Jun 2005 00:59:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342835#M84807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-03T00:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342836#M84808</link>
      <description>Hi Albert:&lt;BR /&gt;
I want  to set the ucs in the current viewport from TopView to FrontView becase I want to draw a circle in the FronView not TopView.  And then I will extrude the circle entity along a 3DPolyLine  path .  But How to do it?</description>
      <pubDate>Fri, 03 Jun 2005 05:30:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342836#M84808</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-03T05:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342837#M84809</link>
      <description>You don't need to set the ucs to do this. You simply set the normal of the &lt;BR /&gt;
Circle to say -1,0,0.&lt;BR /&gt;
&lt;BR /&gt;
ALbert&lt;BR /&gt;
&lt;JIANGFANGJI&gt; wrote in message news:4864333@discussion.autodesk.com...&lt;BR /&gt;
Hi Albert:&lt;BR /&gt;
I want  to set the ucs in the current viewport from TopView to FrontView &lt;BR /&gt;
becase I want to draw a circle in the FronView not TopView.  And then I will &lt;BR /&gt;
extrude the circle entity along a 3DPolyLine  path .  But How to do it?&lt;/JIANGFANGJI&gt;</description>
      <pubDate>Fri, 03 Jun 2005 15:21:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342837#M84809</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-03T15:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342838#M84810</link>
      <description>Hi Albert:&lt;BR /&gt;
Can you give me some sample codes about how to do it?&lt;BR /&gt;
Regards.&lt;BR /&gt;
John Jiang</description>
      <pubDate>Mon, 06 Jun 2005 08:39:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342838#M84810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-06T08:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use function "SetUcs"</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342839#M84811</link>
      <description>Here you go:&lt;BR /&gt;
&lt;BR /&gt;
    public class CircleCreator&lt;BR /&gt;
    {&lt;BR /&gt;
        [CommandMethod("cc")]&lt;BR /&gt;
        public void DoIt()&lt;BR /&gt;
        {&lt;BR /&gt;
            Database db = &lt;BR /&gt;
Application.DocumentManager.MdiActiveDocument.Database;&lt;BR /&gt;
            using (Transaction t = db.TransactionManager.StartTransaction())&lt;BR /&gt;
            {&lt;BR /&gt;
                BlockTable bt = (BlockTable)t.GetObject(db.BlockTableId, &lt;BR /&gt;
OpenMode.ForRead);&lt;BR /&gt;
                BlockTableRecord btr = &lt;BR /&gt;
(BlockTableRecord)t.GetObject(bt[BlockTableRecord.ModelSpace], &lt;BR /&gt;
OpenMode.ForWrite);&lt;BR /&gt;
                //create circle with some arbitrary normal&lt;BR /&gt;
                using (Circle c = new Circle(new Point3d(0,0, 0),new &lt;BR /&gt;
Vector3d(1,1,1),1))&lt;BR /&gt;
                {&lt;BR /&gt;
                    btr.AppendEntity(c);&lt;BR /&gt;
                    t.AddNewlyCreatedDBObject(c, true);&lt;BR /&gt;
                }&lt;BR /&gt;
                t.Commit();&lt;BR /&gt;
            }&lt;BR /&gt;
        }&lt;BR /&gt;
    }&lt;BR /&gt;
&lt;BR /&gt;
&lt;JIANGFANGJI&gt; wrote in message news:4866005@discussion.autodesk.com...&lt;BR /&gt;
Hi Albert:&lt;BR /&gt;
Can you give me some sample codes about how to do it?&lt;BR /&gt;
Regards.&lt;BR /&gt;
John Jiang&lt;/JIANGFANGJI&gt;</description>
      <pubDate>Mon, 06 Jun 2005 16:17:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-use-function-quot-setucs-quot/m-p/1342839#M84811</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-06T16:17:44Z</dc:date>
    </item>
  </channel>
</rss>

