Results 1 to 7 of 7

Thread: dtext rotation variable?

  1. #1
    Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    49
    Login to Give a bone
    0

    Default dtext rotation variable?

    Hi,

    I'm trying to set the default rotation angle for a new dtext object by first clicking an existing object and thus copying it's rotation.
    I know how to get it but can't figure out how to set it.
    Is there a variable for dtext rotation?

    (setq ent (car (entsel)))
    (setq rotationangle (cdr (assoc 50 (entget Ent))))

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    Your code is doing what you asked.
    What else do you need?

    (See Page 144 = http://images.autodesk.com/adsk/file...erence_enu.pdf )
    R.K. McSwain | CAD Panacea |

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    The default value is simply the last one used. While your code returns the rotation of a selected dtext there is no system variable or easy way to preset the default rotation angle for a new dtext object except for annotative text. You could set the system variable snapang to your rotationangle value with ortho on to allow selecting that angle with a pick of the mouse for the first dtext which might make it easier for you:
    Code:
    (setvar 'snapang (cdr (assoc 50 (entget (car (entsel))))))
    Lots of ways to modify the dtext angle after it's drawn as well.

  4. #4
    Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    49
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    Thank You for Your responses!

    This is what I'm trying to accomplish:
    I want to select an object and copy it's properties to my default properties for new objects, a bit like "matchprop" beforehand.



    Code:
    ;;22.28 30.7.2018 T. Järvinen 
    ;;Pick to set object properties
    
    (defun c:1 ( / ent)
    (setq ent (car (entsel "\nSelect object to Make More of the same: ")))
    
    ;; objectlinetype
    (setq objectlinetype (cdr (assoc 6 (entget Ent))))
    (if (setq objectlinetype (cdr (assoc 6 (entget Ent)))) (setvar "celtype" objectlinetype) (setvar "celtype" "ByLayer"))
    ;(setvar "celtype" objectlinetype)
    
    ;; objectlayer
    (setq objectlayer (cdr (assoc 8 (entget Ent))))
    ;(setvar "clayer" objectlayer)
    ;(command "clayer" "")
    (command "clayer" objectlayer)
    
    ;; objectcolor
    (setq objectcolor (cdr (assoc 62 (entget Ent))))
    ;(setvar "cecolor" objectcolor)
    (command "cecolor" objectcolor)
    
    ;;objectlineweight
    (setq objectlineweight (cdr (assoc 43 (entget Ent))))
    (command "plinewid" objectlineweight)
    
    ;;objectlinetypescale
    (if (setq objectlinetypescale (cdr (assoc 48 (entget Ent)))) (setvar "celtscale" objectlinetypescale) (setvar "celtscale" 1))
    ;(setvar "celtscale" objectlinetypescale)
    
    ;;objectlinetypegeneration
    (if (= (cdr (assoc 70 (entget Ent))) 128) (setq objectlinetypegeneration 1) (setq objectlinetypegeneration 0))
    (command "plinegen" objectlinetypegeneration)
    
    ;;objecttextsize
    (if (setq objecttextsize (cdr (assoc 40 (entget Ent)))) (setvar "textsize" objecttextsize) nil)
    
    ;;objecttextstyle
    (if (setq objecttextstyle (cdr (assoc 7 (entget Ent)))) (setvar "textstyle" objecttextstyle) nil)
    
    ;;rotationangle 
    (if (setq rotationangle (* 180.0 (/(cdr (assoc 50 (entget Ent)))pi)))
    	(progn 
    		(command "text" "@" "" rotationangle "erase me")
    		(entdel (entlast))
    	)
    	(progn
    		(command "text" "@" "" 0 "erase me")
    		(entdel (entlast))
    	)
    )
    )
    Last edited by tuomo.jarvinen; 2018-07-30 at 08:01 PM.

  5. #5
    Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    49
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    Oops... I didn't know about "ADDSELECTED" - command
    https://knowledge.autodesk.com/suppo...76050-htm.html

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    Quote Originally Posted by tuomo.jarvinen View Post
    Oops... I didn't know about "ADDSELECTED" - command

    But ADDSELECTED does not replicate the rotation angle.
    R.K. McSwain | CAD Panacea |

  7. #7
    Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    49
    Login to Give a bone
    0

    Default Re: dtext rotation variable?

    ...and neither the polyline width. And it returns the previous settings after one created object.

Similar Threads

  1. AutoCAD - DWF output rotation doesn't match sheet rotation
    By ttaylor.62786 in forum AutoCAD Plotting
    Replies: 3
    Last Post: 2007-02-16, 12:24 AM
  2. AutoCAD 2007 - Set DText default rotation angle back to 0
    By justinsweet in forum AutoCAD General
    Replies: 2
    Last Post: 2006-10-10, 04:20 AM
  3. Replies: 9
    Last Post: 2006-10-05, 09:42 AM
  4. Replies: 2
    Last Post: 2006-10-02, 10:02 PM
  5. Variable height/variable count family (studs in a sloped wall)
    By DoTheBIM in forum Revit Architecture - Families
    Replies: 6
    Last Post: 2006-06-15, 02:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •