### Author Topic: Sset Move and make basepoint 0,0  (Read 3534 times)

0 Members and 1 Guest are viewing this topic.

#### ML

• Guest
##### Sset Move and make basepoint 0,0
« on: December 06, 2007, 12:44:23 PM »

Hello,

I have a bit of code that simply allows me to pick (my objects) on screen, then pick a point.

With that:
I was wondering if anyone has a way or method that I can take the selection set's picked point and move the sset to 0,0
Also, I would like to make 0,0 the basepoint

Any ideas?

Thanks
Mark

#### CmdrDuh

• Automatic Duh Generator
• King Gator
• Posts: 4039
##### Re: Sset Move and make basepoint 0,0
« Reply #1 on: December 06, 2007, 12:54:11 PM »
Here is a simple sub for moving something
Code: [Select]
Sub Example_Move()
' This example creates a circle and then performs
' a move on that circle.

' Create the circle
Dim center(0 To 2) As Double
center(0) = 2#: center(1) = 2#: center(2) = 0#
ZoomAll

' Define the points that make up the move vector
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
point1(0) = 0: point1(1) = 0: point1(2) = 0
point2(0) = 2: point2(1) = 0: point2(2) = 0

MsgBox "Move the circle 2 units in the X direction.", , "Move Example"

' Move the circle
circleObj.Move point1, point2

ZoomAll
MsgBox "Move completed.", , "Move Example"

End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

#### CmdrDuh

• Automatic Duh Generator
• King Gator
• Posts: 4039
##### Re: Sset Move and make basepoint 0,0
« Reply #2 on: December 06, 2007, 12:56:27 PM »
Post what you have and we can change it.  It seems like your almost there.
Code: [Select]
dim ZeroZero(2) as Double
ZeroZero(0)=0:ZeroZero(1)=0:ZeroZero(2)=0
For each Obj in SS
obj.move YourPickedPoint, ZeroZero
next obj
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

#### deegeecees

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #3 on: December 06, 2007, 12:58:41 PM »
The only way I know to make 0,0 your base point in VBA is this:

ThisDrawing.SendCommand "base" & vbCr "0,0" &vbCr (not tested)

It's crude but effective. Add it to CmdrDuhs' code, and there you go.

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #4 on: December 06, 2007, 12:59:29 PM »
Yes right from the help screen
I was already looking at that

I need to move a selection set and there is no method that I know of for doing that

I tried something weird like

Ent = Sset

Ent.move Pnt1, Pnt2

Because Entities can be moved however that may not be the best method either.

Anymore suggestions?

Thanks

Mark

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #5 on: December 06, 2007, 01:02:45 PM »

Ahhhhhh, I was almost there LOL

Code: [Select]
dim ZeroZero(2) as Double
ZeroZero(0)=0:ZeroZero(1)=0:ZeroZero(2)=0
For each Obj in SS
obj.move YourPickedPoint, ZeroZero
next obj

I tried using the object.move method but I did not loop through each obj in the sset

Let me go try

Thanks,

Mark

#### CmdrDuh

• Automatic Duh Generator
• King Gator
• Posts: 4039
##### Re: Sset Move and make basepoint 0,0
« Reply #6 on: December 06, 2007, 01:04:19 PM »
ThisDrawing.SetVariable "INSBASE", "0,0,0"
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #7 on: December 06, 2007, 01:06:17 PM »

Hey deegeecees

Sometimes we have to do it!

Thanks

Mark

#### deegeecees

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #8 on: December 06, 2007, 01:06:38 PM »
ThisDrawing.SetVariable "INSBASE", "0,0,0"

Yup. That too.

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #9 on: December 06, 2007, 01:06:45 PM »
Yes sir!

CM! You the man!

#### CmdrDuh

• Automatic Duh Generator
• King Gator
• Posts: 4039
##### Re: Sset Move and make basepoint 0,0
« Reply #10 on: December 06, 2007, 01:09:43 PM »
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #11 on: December 06, 2007, 01:17:12 PM »

The move is working great, thanks guys!

Now I know how to move an sset but still the inbase variable is not setting ?

Here is what I got

Code: [Select]
Sub MoveSsettoZeroZero()

On Error Resume Next
ThisDrawing.SelectionSets.Item("Selection1").Delete

Dim ZeroZero(0 To 2) As Double
Dim Pnt As Variant

ZeroZero(0) = 0: ZeroZero(1) = 0: ZeroZero(2) = 0

Sset.SelectOnScreen
Debug.Print "Selection Set " & "("; Sset.Name; ")" & " was created"

Pnt = ThisDrawing.Utility.GetPoint(, vbCrLf & "Pickpoint")
Debug.Print "Point = "; Pnt(0) & " , " & Pnt(1)

For Each Obj In Sset
Obj.Move Pnt, ZeroZero
Next Obj

ThisDrawing.SetVariable "INSBASE", ("0, 0, 0")

ThisDrawing.SelectionSets.Item("Selection1").Delete

End Sub

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #12 on: December 06, 2007, 01:18:44 PM »

Ooops

Forget the parenthesis

I am not using them and it is still not working?

Mark

#### CmdrDuh

• Automatic Duh Generator
• King Gator
• Posts: 4039
##### Re: Sset Move and make basepoint 0,0
« Reply #13 on: December 06, 2007, 01:25:45 PM »
what happens if you type INSBASE at the command line?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

#### ML

• Guest
##### Re: Sset Move and make basepoint 0,0
« Reply #14 on: December 06, 2007, 01:30:25 PM »

It returns the base point

However, if you want to set a base point (at least by picking)  in a drawing, you now use base