• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

restoration of wcs coordinate system in vba

  • Thread starter Thread starter rod316
  • Start date Start date

rod316

Guest
through vba I changed the coordinate system from wcs to ucs and through divers to process figures in the space defined by the ucs system.
I need to return to the wcs coordinate system via vba commands.
Thank you.
 
If maybe you put the code or the part that changes ucs...
However this works but the current uct must have a name otherwise by mistake
Code:
sub f_ucsworld()
    dim po_ucs as acaducs
    dim pd_x(2) as double
    dim pd_y(2) as double
    dim pd_or(2) as double
    
    pd_x(0) = 1: pd_x(1) = 0: pd_x(2) = 0
    pd_y(0) = 0: pd_y(1) = 1: pd_y(2) = 0
    pd_or(0) = 0: pd_or(1) = 0: pd_or(2) = 0
    
    set po_ucs = thisdrawing.activeucs
    po_ucs.xvector = pd_x
    po_ucs.yvector = pd_y
    po_ucs.origin = pd_or
    thisdrawing.activeucs = po_ucs
end sub
 
hi "tracciatura.net"
the name is assigned at the creation of the new ucs.
In fact I created a sub that is recalled when necessary for with the only parameter name.
in the sub I choose three points that define me origin, axis x and axis y.

public sub nuovo_ucs(nome_ucs)
' defines a new ucs

dim originenuovo_ucs(0 to 2) as double
dim puntoasse_x(0 to 2) as double
dim puntoasse_y(0 to 2) as double

userform1.hide

point_ origin_click = activedocument.utility.getpoint(, "point of origin")
ax_click = activedocument.utility.getpoint(, "point axis x")
siy_click = activedocument.utility.getpoint(, "point axis y")

origin_ucs(0) = point_ origin_click(0): originnuovo_ucs(1) = point_ origin_click(1): originnuovo_ucs(2) = point_ origin_click(2)
pointasse_x(0) = assex_click(0): puntoasse_x(1) = assex_click(1): puntoasse_x(2)=assex_click(2)
pointasse_y(0) = assey_click(0): puntoasse_y(1) =assey_click(1): puntoasse_y(2)=assey_click(2)

set ucsobj = thisdrawing.usercoordinatesystems.add(original_ucs, pointasse_x, pointasse_y, name_ucs)
thisdrawing.activeucs = ucsobj
thisdrawing.activeviewport.ucsiconon = true
thisdrawing.activeviewport.ucsiconatorigin = true
thisdrawing.activeviewport = thisdrawing.activeviewport

end
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top