Jump to content

Recommended Posts

Posted

The routine below Will create a new UCS and Ordinate dimension and then begin the ordinate command. I've created 4 seperate routines to handle 2 different UCS locations with 2 different Dimstyles for each UCS. One Dimstyle being all red and the other being bylayer.

 

Currently when I run the routine for UCS "A" it works fine. The problems start when I run the routine for UCS "B". Since the UCS is now 0,0 at UCS "A" the routine sets the UCS "B" to a location relative to UCS "A" and not the lower left hand corner of the border.

 

I can't figure out how to reset the UCS back to the drawings original UCS ("World" or 0,0 of border) after using the command so I can run each routine at any given time and land at my specified UCS's.

 

How do I reset the Original border UCS to then reset my 2nd new UCS?

I've tried...

 

(if (tblsearch... at the beginning just after the first setvar.

or

(commmand "ucs" "World")...in the same place

or

(command "ucs" "World")...at the bottom below the last (command...

 

No favorable results. Should I create both new UCS' in the same routine so that it exists as a known point relative to the sht. border? I just can't see it.

 

 

(defun c:frd (/ scmde RedOrd)
 (setq scmde (getvar "cmdecho"))
 (setvar "cmdecho" 0)
  (if (tblsearch "UCS" "PnlFront")
    (command "_ucs" "restore" "PnlFront")
   (progn
     ;;(command "_ucs" "restore" "World")
     (command "_ucs" "New" "236.3125,68.00,0.0")
     (command "_ucs" "Named" "Save" "PnlFront")
     (command "_ucs" "Restore" "PnlFront")
     (command "_ucsicon" "on" "" "ORigen")
   )
 )
 (if (tblsearch "DimStyle" "Red_Ordinate") ; if Red_Ordinate exists,
   (command "DimStyle" "Restore" "Red_Ordinate") ; activate DimStyle
   (progn
     (setvar "DIMADEC" 0)
     (setvar "DIMALT" 0)
     (setvar "DIMALTD" 2)
     (setvar "DIMALTF" 25.4000)
     (setvar "DIMALTRND" 0.0000)
     (setvar "DIMALTTD" 2)
     (setvar "DIMALTTZ" 0)
     (setvar "DIMALTU" 2)
     (setvar "DIMALTZ" 0)
     (setvar "DIMAPOST" "")
     (setvar "DIMASSOC" 1)
     (setvar "DIMASZ" 0.1250)
     (setvar "DIMATFIT" 3)
     (setvar "DIMAUNIT" 0)
     (setvar "DIMAZIN" 0)
     (setvar "DIMBLK" "")
     (setvar "DIMBLK1" "")
     (setvar "DIMBLK2" "")
     (setvar "DIMCEN" 0.0938)
     (setvar "DIMCLRD" 1)
     (setvar "DIMCLRE" 1)
     (setvar "DIMCLRT" 1)
     (setvar "DIMDEC" 2)
     (setvar "DIMDLE" 0.0000)
     (setvar "DIMDLI" 0.3750)
     (setvar "DIMDSEP" ".")
     (setvar "DIMEXE" 0.0938)
     (setvar "DIMEXO" 0.1250)
     (setvar "DIMFIT" 3)
     (setvar "DIMFRAC" 2)
     (setvar "DIMGAP" 0.0625)
     (setvar "DIMJUST" 0)
     (setvar "DIMLDRBLK" "")
     (setvar "DIMLFAC" 1.0000)
     (setvar "DIMLIM" 0)
     (setvar "DIMLUNIT" 5)
     (setvar "DIMLWD" -2)
     (setvar "DIMLWE" -2)
     (setvar "DIMPOST" "\"")
     (setvar "DIMRND" 0.0000)
     (setvar "DIMSAH" 0)
     (setvar "DIMSCALE" 8.0000)
     (setvar "DIMSD1" 0)
     (setvar "DIMSD2" 0)
     (setvar "DIMSE1" 0)
     (setvar "DIMSE2" 0)
     (setvar "DIMSHO" 1)
     (setvar "DIMSOXD" 0)
     (setvar "DIMTAD" 0)
     (setvar "DIMTDEC" 4)
     (setvar "DIMTFAC" 1.0000)
     (setvar "DIMTIH" 0)
     (setvar "DIMTIX" 1)
     (setvar "DIMTM" 0.0000)
     (setvar "DIMTMOVE" 0)
     (setvar "DIMTOFL" 0)
     (setvar "DIMTOH" 0)
     (setvar "DIMTOL" 0)
     (setvar "DIMTOLJ" 1)
     (setvar "DIMTP" 0.0000)
     (setvar "DIMTSZ" 0.0000)
     (setvar "DIMTVP" 0.0000)
     ;;(setvar "DIMTXSTY" "DIMEN")
     ;;(setvar 4 . "\"")
     (setvar "DIMTXT" 0.1250)
     (setvar "DIMTZIN" 0)
     (setvar "DIMUNIT" 7)
     (setvar "DIMUPT" 0)
     (setvar "DIMZIN" 3)
     (command "_.-dimstyle" "Save" "Red_Ordinate")
     (command "_.-dimstyle" "Restore" "Red_Ordinate")
   )
 )
 (command "dimordinate")
 (princ)
)     ;end defun

 

Thanks for taking the time.

JD

Posted

Using TRANS function you may transform the coordinates from one coordinates system to another:

(setq point1st (getpoint)
     point2nd (getpoint))
(command "_UCS" point1st "" "")
(command "_UCS" (trans point2nd 0 1) "" "")

Not sure why reseting the UCS to WCS doesn't work; I will try to have a look on your code later.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...