Chuyển đến nội dung
Diễn đàn CADViet
Đăng nhập để thực hiện theo  
rungxanhonline

Làm sao để thay đổi gốc tọa độ

Các bài được khuyến nghị

Có anh em nào rảnh giúp mình cái nhỉ? đang cần gấp. Thank!

 

 

Bạn nghiên cứu thử phương thức TranslateCoordinates xem sao nhé:

 

Sub Example_TranslateCoordinates()
' This example creates a UCS with an origin at 2, 2, 2.
' Next, a point is entered by the user. The WCS and UCS
' coordinates of that point are output in a Msgbox.

' Create a UCS named "New_UCS" in current drawing
Dim ucsObj As AcadUCS
Dim origin(0 To 2) As Double
Dim xAxisPnt(0 To 2) As Double
Dim yAxisPnt(0 To 2) As Double

' Define the UCS
origin(0) = 2#: origin(1) = 2#: origin(2) = 2#
xAxisPnt(0) = 5#: xAxisPnt(1) = 2#: xAxisPnt(2) = 2#
yAxisPnt(0) = 2#: yAxisPnt(1) = 6#: yAxisPnt(2) = 2#

' Add the UCS to the UserCoordinatesSystems collection
Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPnt, yAxisPnt, "New_UCS")
ThisDrawing.ActiveUCS = ucsObj

' Get the active viewport and make sure the UCS icon is on
Dim viewportObj As AcadViewport
Set viewportObj = ThisDrawing.ActiveViewport
viewportObj.UCSIconOn = True
viewportObj.UCSIconAtOrigin = True
ThisDrawing.ActiveViewport = viewportObj

' Have the user enter a point
Dim pointWCS As Variant
pointWCS = ThisDrawing.Utility.GetPoint(, "Enter a point to translate:")

' Translate the point into UCS coordinates
Dim pointUCS As Variant
pointUCS = ThisDrawing.Utility.TranslateCoordinates(pointWCS, acWorld, acUCS, False)

' Display the coordinates of the point
MsgBox "The point has the following coordinates:" & vbCrLf & _
		"WCS: " & pointWCS(0) & ", " & pointWCS(1) & ", " & pointWCS(2) & vbCrLf & _
		"UCS: " & pointUCS(0) & ", " & pointUCS(1) & ", " & pointUCS(2), , "TranslateCoordinates Example"

End Sub

  • Vote tăng 1

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác

Tạo một tài khoản hoặc đăng nhập để nhận xét

Bạn cần phải là một thành viên để lại một bình luận

Tạo tài khoản

Đăng ký một tài khoản mới trong cộng đồng của chúng tôi. Điều đó dễ mà.

Đăng ký tài khoản mới

Đăng nhập

Bạn có sẵn sàng để tạo một tài khoản ? Đăng nhập tại đây.

Đăng nhập ngay
Đăng nhập để thực hiện theo  

×