.NET

Reply
Valued Contributor
wowens63
Posts: 98
Registered: ‎06-22-2007
Message 1 of 2 (240 Views)

setting UCS

240 Views, 1 Replies
06-08-2012 11:19 AM

I'm new to vb.net and i'm trying to make some basic code to use in my programs.

I was wondering if some of you could give me your thought about my code.

 

Shared Function UCS_Set(ByVal DBIn As Database, ByVal Point1 As Point3d, ByVal Point2 As Point3d, Optional ByVal Z_axix_InLine_With_Points As Boolean = False) As Matrix3d
        Dim ZAxis As Vector3d
        Dim yAxis As Vector3d
        Dim xAxis As Vector3d

        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor

        Try
            If Z_axix_InLine_With_Points = True Then
                ZAxis = Point1.GetVectorTo(Point2).GetNormal
                yAxis = ZAxis.GetPerpendicularVector.GetNormal
                xAxis = yAxis.CrossProduct(ZAxis).GetNormal()
            Else
                xAxis = Point1.GetVectorTo(Point2).GetNormal
                yAxis = xAxis.GetPerpendicularVector.GetNormal
                ZAxis = xAxis.CrossProduct(yAxis).GetNormal()
            End If

            Dim NewMatrix3d As Matrix3d = Matrix3d.AlignCoordinateSystem(Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis, Point1, xAxis, yAxis, ZAxis)

            UCS_Set = NewMatrix3d
        Catch
            UCS_Set = Nothing
        End Try
    End Function

 

 

ADN Support Specialist
philippe.leefsma
Posts: 676
Registered: ‎06-02-2009
Message 2 of 2 (172 Views)

Re: setting UCS

08-14-2012 09:16 AM in reply to: wowens63

Hi There,

 

It's hard to give you some help on that one, especially that you don't tell what is the issue with the code and what you are trying to achieve exactly... Is the code not producing the expected result or you don't know how to get it done?

 

Are you aware about the AutoCAD DevBlog, you will find there many useful code samples:

 

http://adndevblog.typepad.com/autocad/

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.