About Translate Coordinate
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
About Translate Coordinate

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
anttam
Guest





Posted: Tue Mar 29, 2005 9:22 pm    Post subject: About Translate Coordinate Reply with quote

If I want to move the origin to a point (e.g. 3,4,0) to do something and inverse the move, how to implement?
Please show me with simple example.

What I know the source codes are:
Quote:
ThisDrawing.SendCommand "_ucs "
ThisDrawing.SendCommand "_w "
.TranslateCoordinates(Point, From, To, Displacement [, Norm])
but I really don't know to use them correctly.

Please help, thanks!

Back to top
Oberer
Guest





Posted: Tue Mar 29, 2005 10:57 pm    Post subject: Re: About Translate Coordinate Reply with quote

anttam,
Would you mind providing additional information?

"If I want to move the origin to a point (e.g. 3,4,0) to do something and inverse the move, how to implement?
Please show me with simple example."

Can you explain "inverse the move"?
Back to top
Dave
Guest





Posted: Wed Mar 30, 2005 10:05 am    Post subject: Re: About Translate Coordinate Reply with quote

Here is a practical example. Hope it helps you understand bringing it in and
sending it out. This hard codes the z to zero, like the point filter in ACAD
that many do not know how to use.

Public Sub Movec(AcadApp As AcadApplication)

Dim Ent As AcadEntity
Dim returnPnt1 As Variant
Dim returnPnt2 As Variant
Dim ssetObj As AcadSelectionSet
Dim fromPoint(0 To 2) As Double
Dim movePoint(0 To 2) As Double
Dim ucsObj As AcadUCS
Dim WCSPnt1 As Variant
Dim WCSPnt2 As Variant
Dim UCSPnt1 As Variant
Dim UCSPnt2 As Variant
Dim currUCS As AcadUCS
Dim fixfrompoint As Variant
Dim fixtopoint As Variant


Set AutoCAD_Application = AcadApp
Set thisdrawing = AutoCAD_Application.ActiveDocument
On Error Resume Next
thisdrawing.SelectionSets("prev").Delete
Set ssetObj = thisdrawing.SelectionSets.Add("prev")
ssetObj.Select acSelectionSetPrevious

thisdrawing.SendCommand "_ucs "
thisdrawing.SendCommand "_v "

Set currUCS = thisdrawing.ActiveUCS

returnPnt1 = thisdrawing.Utility.GetPoint(, "Pick a from point: ")
returnPnt2 = thisdrawing.Utility.GetPoint(, "Pick a to point: ")



For Each Ent In ssetObj

WCSPnt1 = returnPnt1
UCSPnt1 = thisdrawing.Utility.TranslateCoordinates(WCSPnt1, acWorld,
acUCS, False)

WCSPnt2 = returnPnt2
UCSPnt2 = thisdrawing.Utility.TranslateCoordinates(WCSPnt2, acWorld,
acUCS, False)

fromPoint(0) = UCSPnt1(0)
fromPoint(1) = UCSPnt1(1)
fromPoint(2) = 0

movePoint(0) = UCSPnt2(0)
movePoint(1) = UCSPnt2(1)
movePoint(2) = 0

fixfrompoint = thisdrawing.Utility.TranslateCoordinates(fromPoint,
acUCS, acWorld, False)
fixtopoint = thisdrawing.Utility.TranslateCoordinates(movePoint,
acUCS, acWorld, False)

Ent.Move fixfrompoint, fixtopoint
Ent.Update

Next

thisdrawing.SendCommand "_ucs "
thisdrawing.SendCommand "p "

End Sub

--
David Wishengrad
President & CTO
MillLister, Inc.
Software for BOM, measuring, stretching, feature recognition, and
controlling visibility of
multiple 3D solids.
Http://Construction3D.com
"Oberer" <nospam@address.withheld> wrote in message
news:3597748.1112119073742.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
anttam,
Would you mind providing additional information?

"If I want to move the origin to a point (e.g. 3,4,0) to do something and
inverse the move, how to implement?
Please show me with simple example."

Can you explain "inverse the move"?


Back to top
anttam
Guest





Posted: Thu Mar 31, 2005 7:09 pm    Post subject: Re: About Translate Coordinate Reply with quote

what I want is...
move the origin from (0,0) to (3,4) and do something
then move the origin from (3,4) back to (0,0), that is what "inverse the move"
Back to top
anttam
Guest





Posted: Thu Mar 31, 2005 7:28 pm    Post subject: Re: About Translate Coordinate Reply with quote

Hi~ Dave
Thanks for the example, but I saw it in Discussion Groups before that I don't it was what I expected.

For example,
pt1 = 3,4 & pt2 = 5,4
------------------------------------------------------------------
Move the origin to pt1
now pt1 = 0,0 & pt2 = 2,0 --> so that I can do some analysis
-------------------------------------------------------------------
Inverse the move
now pt1 = 3,4 & pt2 = 5,4

This is what I want but don't know how to implement.
Any idea, please!
Back to top
Oberer
Guest





Posted: Thu Mar 31, 2005 7:38 pm    Post subject: Re: About Translate Coordinate Reply with quote

What are you basing this "origin" on?
Can you use saved UCSs or are you wanting to create these based on objects?

"so that I can do some analysis"
what type of analysis are you doing that requires this shift?
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB