Jump to content

Set Ambient Drawing Settings Angular Units


Recommended Posts

Posted

Two simple problems - which hopefully have two simple answers:

I am writing a script to change the ambient drawing settings (see screenshot).

Everything works except I can't close the text window after running the units command, and the ambient angular units don't get set (highlighted red in the screenshot). Is there an ade command that'll do this?

cheers,

 

   ;Set projection to NAD83 UTM10 by default
   (ade_projsetwscode "UTM83-10")
   ;System Variables to be set
   ;Set Units
   (command "-aecdwgunits" 6 2 3 "No" "No");works
   (command)
   (command "-units" 2 3 2 8 270 "Y");works - but doesn't set ambient angular units
   (command)
   ;Shut off text window
   (command "graphscr"); doesn't work
   (command)

attachment.php?attachmentid=56238&cid=1&stc=1

AmbSettings.png

Posted

Behind say Units is a series of variables as an example below there should be the same for aecdwgsetup just need to find, 2 ways use express, tools, System variable editor.

Or do setvar ? * change 1 at a time.

 

(SETVAR "LUNITS" 2)
(SETVAR "ANGBASE" 0.0)
(SETVAR "ANGDIR" 0)
(SETVAR "LUPREC" 0)
(SETVAR "AUNITS" 0)
(SETVAR "AUPREC" 0)

Posted

You need to get the Ambient Settings Object through the Civil Application Interface. This may get you going.

 

(setq prod (vlax-product-key))
 (setq	prodStr	(strcat	"AeccXUiLand.AeccApplication"
		(cond ((vl-string-search "\\R17.0\\" prod)
		       ".4.0"
		      )
		      ;;2007
		      ((vl-string-search "\\R17.1\\" prod)
		       ".5.0"
		      )
		      ;;2008
		      ((vl-string-search "\\R17.2\\" prod)
		       ".6.0"
		      )
		      ;;2009
		      ((vl-string-search "\\R18.0\\" prod)
		       ".7.0"
		      )
		      ;;2010
		      ((vl-string-search "\\R18.1\\" prod)
		       ".8.0"
		      )
		      ;;2011
		      ((vl-string-search "\\R18.2\\" prod)
		       ".9.0"
		      )
		      ;;2012
		      ((vl-string-search "\\R19.0\\" prod)
		       ".10.0"
		      )
		      ;;2013
		      ((vl-string-search "\\R19.1\\" prod)
		       ".10.3"
		      )
		      ;;2014
		      ((vl-string-search "\\R20.0\\" prod)
		       ".10.4"
		      )
		      ;;2015
		      (t "")
		)
	)
 )

(setq aeccApp (vlax-invoke-method (vlax-get-acad-object) 'GetInterfaceobject prodstr));Get the Civil Application

(setq aeccDoc (vlax-get-property aeccApp 'ActiveDocument)) ;Get the Active Civil Document from the Civil Application

(setq sets (vlax-get-property aeccDoc 'Settings)) ;Get the Root Settings from the Document

(setq dwgset (vlax-get-property sets 'DrawingSettings)) ;Get the Drawing Settings from the Root Settings

(setq ambset (vlax-get-property dwgset 'AmbientSettings)) ;Get the Ambient Settings from the dwg settings

 

 

As far as the Text Screen goes try:

 

(graphscr) 
;or
(textscr)

Posted

Thanks Hippe013 - this looks promising. I'll give it a go after things slow down a bit for the holidays...

  • 3 months later...
Posted

Ok so the script is working now and does what I want it to do...except the text window will not close. (graphscr) returns nil as expected - so I have:

(graphscr)

(princ)

 

And I've tried various iterations:

(command "graphscr")

or

(command "_.graphscr")

And they all return nil so I know its running the command...yet the text window just will not close....

If I run any of those after the lisp has completed it close the window as expected. Or if I hit F2 it closes - just not from the lisp....grrr....

Any thoughts?

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...