<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3680612460647631152</id><updated>2024-09-26T17:24:04.681-07:00</updated><category term="Acad"/><category term="AutoCad"/><category term="Code"/><category term="UCS"/><category term="VB"/><category term="VBA"/><category term="coding"/><category term="coding autocad"/><category term="vba UCS autocad"/><title type='text'>AutoCad VBA</title><subtitle type='html'>How To Make AutoCad Your Bitch - &#xa;&#xa;A product of SolidStateBrains</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://acadvba.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3680612460647631152/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://acadvba.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>A Pennington</name><uri>http://www.blogger.com/profile/14059971424542650877</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip63k1Ibha31TlhsaccsgaMC0k5H3VWBonraSrABv6yMvg-Lf9AVVpSpyQ6VAiAR_VWoolrdLFHwzPGdxz5uabuuzEZvpy4WYoVHGDFd08G16maY0fZgXgGQ4UDDY_Uak/s220/l_62d77f69783b050270bb8761330069d9.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3680612460647631152.post-5538679866309511887</id><published>2010-02-20T21:16:00.000-08:00</published><updated>2010-02-20T22:30:57.081-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Acad"/><category scheme="http://www.blogger.com/atom/ns#" term="AutoCad"/><category scheme="http://www.blogger.com/atom/ns#" term="Code"/><category scheme="http://www.blogger.com/atom/ns#" term="coding"/><category scheme="http://www.blogger.com/atom/ns#" term="coding autocad"/><category scheme="http://www.blogger.com/atom/ns#" term="UCS"/><category scheme="http://www.blogger.com/atom/ns#" term="VB"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><category scheme="http://www.blogger.com/atom/ns#" term="vba UCS autocad"/><title type='text'>Make VBA modify the UCS</title><content type='html'>I&#39;ve spent a lot of time scouring the internet on how to program VBA in AutoCad and Excel and both. What I&#39;ve found is that despite all the resources out there I had to figure a lot of things out on my own. Well, for the remaining year while AutoCad still offers VBA support I thought I would wholesale post everything. Today&#39;s lesson: Understand the Acad UCS and make VBA change it for you.&lt;br /&gt;&lt;br /&gt;             Ok, so first off, there are a lot of different code bits you can dig up if you type in VBA and UCS into google, most of the ones I found to be inadequate or just wrong. What I wanted was a function that could take a line and rotate the UCS based on that startpoint of that line. There is no such code you will find on the inter-webs. Except here.&lt;br /&gt;&lt;br /&gt;Things to remember:&lt;br /&gt;&lt;ol&gt;&lt;li&gt; The UCS is manipulated by the X, Y  and origin coordinates only. If you want to rotate the on the Z axis change the location of the z coordinate in the X/Y vector&lt;/li&gt;&lt;li&gt;The X and Y vectors must be perpendicular to one another. If your X and Y are not perpendicular then you get an ugly error message and you are attempting to use a non rectangular coordinate system which doesn&#39;t really exist. &lt;/li&gt;&lt;li&gt;Understand How the &lt;a href=&quot;http://www.sparknotes.com/math/trigonometry/trigonometricfunctions/section3.rhtml&quot;&gt;Trigonometric Functions&lt;/a&gt; in different quadrants affect what you are doing.&lt;/li&gt;&lt;li&gt;The UCS is comprised of an X,Y and Z vector that is defined by the X, Y and Origin point.  &lt;/li&gt;&lt;/ol&gt;&lt;div&gt;For this code to work you need an origin point and a X(x,y,z) and a Y(x,y,z) &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For my purposes I wrote some code that selects lines in a drawing and uses the origin point of the line to rotate the the UCS. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      First you need to Dimension some variables: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;             &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Dim Origin(2) As Double     &#39;origin array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Dim xAxisPNT(2) As Double   &#39;xaxis point&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Dim yAxisPNT(2) As Double   &#39;yaxis point&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Dim Rotation as double      &#39;the rotation angle of the line&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Dim bSIN As Double&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Dim bCOS As Double&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Dim bTAN As Double&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Dim ucsObj As AcadUCS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     bSIN = Sin(rotation)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     bCOS = Cos(rotation)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     bTAN = Tan(rotation)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;            All you need here is the ORIGIN Point and the rotation of the line, (I&#39;ll cover selecting                 the line in a later post) here&#39;s the math: &lt;/div&gt;&lt;div&gt;&lt;div&gt;            NOTE: ABS value was used for all the formulas, even though it was _&lt;/div&gt;&lt;div&gt;            not needed for all the formulas. _&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;select case TRUE &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;            &#39;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;case quadrant I, all functions are positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;     Case bSIN &gt; 0 And bCOS &gt; 0 And bTAN &gt; 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0) + 1 * Cos(rotation) &#39;x1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) + 1 * Sin(rotation) &#39;y1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) - 1 * Sin(rotation) &#39;x2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1) + 1 * Cos(rotation) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;                 &#39;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;case quadrant II, sine is positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bSIN &gt; 0 And bCOS &lt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;quadrant II rotation x,y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0) - 1 * Abs(Cos(rotation)) &#39;x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) + 1 * Abs(Sin(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) - 1 * Abs(Sin(rotation)) &#39;x2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1) - 1 * Abs(Cos(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;case quadrant III, tan is positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bSIN &lt;&gt; 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;quadrant III rotation x,y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0) - 1 * Abs(Cos(rotation)) &#39;x2     &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) - 1 * Abs(Sin(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) - 1 * Abs(Sin(rotation)) &#39;x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1) + 1 * Abs(Cos(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;case quadrant IV, cosine is posistive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;quadrant III rotation x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bSIN &lt;&gt; 0 And bTAN &lt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;quadrant IV rotation x,y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0) + 1 * Abs(Cos(rotation)) &#39;x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) - 1 * Abs(Sin(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) + 1 * Abs(Sin(rotation)) &#39;x2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1) + 1 * Abs(Cos(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;case rotation = 180&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bCOS = -1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;x,y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;case rotation = 90&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bSIN = 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;x,y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       &#39;case rotation = 270&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       Case bSIN = -1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       xAxisPNT(1) = Origin(1) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(0) = Origin(0) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;       yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;End select &lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Set ucsObj = ThisDrawing.UserCoordinateSystems.Add _&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;(Origin, xAxisPNT, yAxisPNT, &quot;New_UCS&quot;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;ThisDrawing.ActiveUCS = ucsObj&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;                  And that&#39;s it for X, Y... however, I wanted to rotate to the X, Z so my cases were                            slightly different: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Select Case True &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case rotation = 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bCOS = 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;X,Z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case rotation = 180&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bCOS = -1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case rotation = 90&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN = 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case rotation = 270&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN = -1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) - 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case quadrant I, all functions are positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN &gt; 0 And bCOS &gt; 0 And bTAN &gt; 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;Quadrant I rotation, x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) + 1 * Cos(rotation) &#39;x1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) + 1 * Sin(rotation) &#39;y1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1 * Cos(rotation) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case quadrant II, sine is positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN &gt; 0 And bCOS &lt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;quadrant II rotation x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) - 1 * Abs(Cos(rotation)) &#39;x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) + 1 * Abs(Sin(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) - 1 * Abs(Cos(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case quadrant III, tan is positive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN &lt;&gt; 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;quadrant III rotation x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) - 1 * Abs(Cos(rotation)) &#39;x2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) - 1 * Abs(Sin(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1 * Abs(Cos(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;case quadrant IV, cosine is posistive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;Case bSIN &lt;&gt; 0 And bTAN &lt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;&#39;quadrant IV rotation x,z&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(0) = Origin(0) + 1 * Abs(Cos(rotation)) &#39;x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;xAxisPNT(1) = Origin(1) - 1 * Abs(Sin(rotation)) &#39;y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(0) = Origin(0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(1) = Origin(1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;yAxisPNT(2) = Origin(1) + 1 * Abs(Cos(rotation)) &#39;y2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;;&quot;&gt;End Select&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hopefully that demystifies the UCS a little. Feel Free to use this code, modify it, bend it to your will, just let me know! And feel free to email me with any questions or comments! &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;Pennington.Pennington@Gmail.com&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Copyright 2010 SolidStateBrains&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://acadvba.blogspot.com/feeds/5538679866309511887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://acadvba.blogspot.com/2010/02/make-vba-modify-ucs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3680612460647631152/posts/default/5538679866309511887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3680612460647631152/posts/default/5538679866309511887'/><link rel='alternate' type='text/html' href='http://acadvba.blogspot.com/2010/02/make-vba-modify-ucs.html' title='Make VBA modify the UCS'/><author><name>A Pennington</name><uri>http://www.blogger.com/profile/14059971424542650877</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip63k1Ibha31TlhsaccsgaMC0k5H3VWBonraSrABv6yMvg-Lf9AVVpSpyQ6VAiAR_VWoolrdLFHwzPGdxz5uabuuzEZvpy4WYoVHGDFd08G16maY0fZgXgGQ4UDDY_Uak/s220/l_62d77f69783b050270bb8761330069d9.jpg'/></author><thr:total>0</thr:total></entry></feed>