Move UCS

Move UCS

Anonymous
Not applicable
516 Views
5 Replies
Message 1 of 6

Move UCS

Anonymous
Not applicable
Hello
I've got a question about the UCS. My plan is to insert a block that wil be filled in whit text from a userform. But the insertpoint of the block can be different every time. because you can pick it on the screen when you insert him. So the coördinates of the text have to be taken from the insertpoint of the block. So the text stands on the right place no matter where you place the block.

Can somebody help me?
Senne
0 Likes
517 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
You could use Attributes.
or am I misunderstanding your problem?
0 Likes
Message 3 of 6

Anonymous
Not applicable
yes i could do it also with atributes, but i have to do it with vba. So I need to know the code for moving my UCS so I can let it
automaticly connect it with the insertpoint of my block.
Something like this:

UCS = BlockInsertPoint

So i can say after that line in vba: TextBox1 = 124, 23 (those numbers will always be the same)
And where ever you place your block, the text that you place in textbox1 will always be on the right place in the block...

Do you understand what i'm trying to do? 🙂
0 Likes
Message 4 of 6

Anonymous
Not applicable
I'm not sure if VBA will accept coordinate input in UCS...
But you can try thisdrawing.usercoordinatesystem.add to create a new UCS.

or insert the textobjects relative to the block insertionpoint

posting your code would be useful if you need detailed help.
0 Likes
Message 5 of 6

Anonymous
Not applicable
Hi

Yes I think it would work if i can insert the textobjects relative to the block insertionpoint.
Do you know how I can set the textobjects relative to the block insertionpoint? I already have this code to insert the block:

Dim InsertPointBlock As Variant
Dim naam As String
Dim Block As AcadBlockReference


InsertPointBlock = ThisDrawing.Utility.GetPoint(, "...")

On Error Resume Next

Set Block = ThisDrawing.PaperSpace.InsertBlock(InsertPointBlock, naam, 1, 1, 1, 0)

If Err Then
Set Block = ThisDrawing.PaperSpace.InsertBlock(InsertPointBlock, "C:...", 1, 1, 1, 0)
Err.Clear
End If


As so far this works perfect, I can place the block in the paperspace but now i need to get the text on the right place in the
block.

thanx
0 Likes
Message 6 of 6

Anonymous
Not applicable


Dim txtIns(2)

txtIns(0) = InsertPointBlock(0) + [Value to add] 'X
txtIns(1) = InsertPointBlock(1) + [Value to add] 'Y
txtIns(2) = 0# 'Z

thisdrawing.modelspace.addtext "MyValue", txtins, ....



st0neface
0 Likes