|
|
#1 |
|
Junior Member
![]() Using: AutoCAD 2007 Join Date: Aug 2009
Posts: 18
|
I've got a routine where I'm placing text with bottom centered justification. The insertion point (tp) is where I want the text to be centered upon, and is being used for group code 10. How can I find group code 11? Currently it places the text anyway but breaks out of the routine (error: bad DXF group: (11)). Thanks for your help!
Here's what I got: Code:
(setq tp (getpoint "\nSelect Text Insertion Point: "))
(setq bln (getstring "\nEnter Text: "))
(entmake
(list
(cons 0 "TEXT")
(cons 8 lyr)
(cons 10 tp)
(cons 11 tp)
(cons 40 0.062)
(cons 1 bln)
(cons 50 0)
(cons 7 "ROMANS")
(cons 71 0)
(cons 72 1)
(cons 73 0)
)
)
EDIT: hmm seems to be working now. found the error that came from somewhere else. Last edited by hokie555 : 3rd Nov 2009 at 08:11 pm. |
|
|
|
|
|
#2 |
|
Super Member
![]() ![]() ![]() ![]() |
hokie 555,
I hope you do not mind, But I made a complete function out of it. I hope this helps you. I did not bother to add any snaps or orthomode. I will be glad to answer your questions after you test it. I basically created the entity with respect to 0,0,0 and moved it to the insertion point. Code:
(defun C:MTCJ (/ EXDR TFBP TSBP BLN INPT) ;Define function (Make Text Center Justified), Declare local variables
(setq EXDR (list 0.0 0.0 1.0)) ;Set extrusion direction (Needed for 3D only)
(setq TFBP (list 0.0 0.0 0.0)) ;Set text first base point
(setq TSBP (list -0.023619 -0.031 0.0)) ;Set text second base point
(MTCJ_LAYER "TEXT" "2" "") ;Set layer name, color & linetype
(MTCJ_FONT) ;Set font
(setq BLN (getstring "\nEnter Text: ")) ;Enter the string
(setq INPT (getpoint "\nSelect Text Insertion Point: ")) ;Enter the insertion point
(entmake ;Start entity make
(list ;Start list
(cons 0 "TEXT") ;Entity type
(cons 8 "TEXT") ;Layer name
(cons 10 TSBP) ;Text second base point
(cons 40 0.062) ;Text height
(cons 1 BLN) ;Text string
(cons 50 0.0) ;Text rotation
(cons 41 1.0) ;Relative x scale factor
(cons 51 0.0) ;Oblique angle
(cons 7 "ROMANS") ;Text style
(cons 71 0) ;Text generation flag
(cons 72 1) ;Horizontal justification flag center
(cons 11 TFBP) ;Text first base point
(cons 210 EXDR) ;Extrusion direction (Needed for 3D)
(cons 73 2) ;Vertical justification
) ;End list
) ;End entity make
(command "_.move" "_l" "" TFBP INPT "") ;Move command, last object from text first base point to insertion point
(prompt "\nRotation Angle: ") ;Get rotation angle
(command "_.rotate" "_l" "" INPT pause) ;Rotate command, last object, rotate on insertion point
) ;End defun
(defun MTCJ_FONT () ;Define function (FONT)
(command "_.STYLE" "romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;style command
(princ) ;Exit quietly
) ;End defun
(defun MTCJ_LAYER (NLAY CLR LT / LAY FRZ) ;Define function (Make Layer), Declare local varibles & arguments
(setq LAY (tblsearch "layer" NLAY)) ;Search drawing for layer
(if (not LAY) ;If layer not found
(command "_.-layer" "_m" NLAY "_c" CLR "" "_lt" LT "" "") ;Make layer, color & linetype
(progn ;Then do the following
(setq FRZ (cdr (assoc 70 LAY))) ;Look for frozen layers from last edit
(if (= FRZ 65) ;if any layers frozen
(progn ;Then do the following
(command "_.-layer" "_t" NLAY "") ;Thaw layer
(command "_.-layer" "_s" NLAY "") ;Set layer
) ;End progn
(command "_.-layer" "_s" NLAY "") ;Set layer
) ;End if
) ;End progn
) ;End if
(princ) ;Exit quietly
) ;End defun
Last edited by The Buzzard : 3rd Nov 2009 at 10:23 pm. |
|
|
|
|
|
|
|
|
#3 |
|
Super Member
![]() ![]() ![]() ![]() |
If this helps any, This is how I get the entity list.
Code:
(defun C:pdxf (/ pick)
(if (setq pick (car (entsel "\nSelect Object: ")))
(progn (textscr)
(foreach x (entget pick)
(print x))))
(princ))
Run this program and select the entity. A list will be returned. |
|
|
|
|
|
|
|
|
#4 |
|
Super Member
![]() ![]() ![]() ![]() |
Sorry,
This one is bottom centered. The first code was middle centered. Sorry for the mix up. Type MTBC for this code. Code:
(defun C:MTBC (/ EXDR TFBP TSBP BLN INPT) ;Define function (Make Text Center Justified), Declare local variables
(setq EXDR (list 0.0 0.0 1.0)) ;Set extrusion direction (Needed for 3D only)
(setq TFBP (list 0.0 0.0 0.0)) ;Set text first base point
(setq TSBP (list -0.023619 0.0206667 0.0)) ;Set text second base point
(MTCJ_LAYER "TEXT" "2" "") ;Set layer name, color & linetype
(MTCJ_FONT) ;Set font
(setq BLN (getstring "\nEnter Text: ")) ;Enter the string
(setq INPT (getpoint "\nSelect Text Insertion Point: ")) ;Enter the insertion point
(entmake ;Start entity make
(list ;Start list
(cons 0 "TEXT") ;Entity type
(cons 8 "TEXT") ;Layer name
(cons 10 TSBP) ;Text second base point
(cons 40 0.062) ;Text height
(cons 1 BLN) ;Text string
(cons 50 0.0) ;Text rotation
(cons 41 1.0) ;Relative x scale factor
(cons 51 0.0) ;Oblique angle
(cons 7 "ROMANS") ;Text style
(cons 71 0) ;Text generation flag
(cons 72 1) ;Horizontal justification flag center
(cons 11 TFBP) ;Text first base point
(cons 210 EXDR) ;Extrusion direction (Needed for 3D)
(cons 73 1) ;Bottom justification
) ;End list
) ;End entity make
(command "_.move" "_l" "" TFBP INPT "") ;Move command, last object from text first base point to insertion point
(prompt "\nRotation Angle: ") ;Get rotation angle
(command "_.rotate" "_l" "" INPT pause) ;Rotate command, last object, rotate on insertion point
) ;End defun
(defun MTCJ_FONT () ;Define function (FONT)
(command "_.STYLE" "romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;style command
(princ) ;Exit quietly
) ;End defun
(defun MTCJ_LAYER (NLAY CLR LT / LAY FRZ) ;Define function (Make Layer), Declare local varibles & arguments
(setq LAY (tblsearch "layer" NLAY)) ;Search drawing for layer
(if (not LAY) ;If layer not found
(command "_.-layer" "_m" NLAY "_c" CLR "" "_lt" LT "" "") ;Make layer, color & linetype
(progn ;Then do the following
(setq FRZ (cdr (assoc 70 LAY))) ;Look for frozen layers from last edit
(if (= FRZ 65) ;if any layers frozen
(progn ;Then do the following
(command "_.-layer" "_t" NLAY "") ;Thaw layer
(command "_.-layer" "_s" NLAY "") ;Set layer
) ;End progn
(command "_.-layer" "_s" NLAY "") ;Set layer
) ;End if
) ;End progn
) ;End if
(princ) ;Exit quietly
) ;End defun
|
|
|
|
|
|
|
|
|
#5 |
|
Super Member
![]() ![]() ![]() ![]() Using: Civil 3D 2009 Join Date: Apr 2008
Posts: 1,488
|
This might also help for object info extraction:
Code:
;;; VLA & DXF Info of selected Primary or Nested object
;;; Alan J. Thompson
(defun c:Info (/ #Choice #Obj)
(vl-load-com)
(initget 0 "Nested Primary")
(and (or (setq #Choice (getkword "\nNested or Primary object [Nested/<Primary>]: "))
(setq #Choice "Primary")
) ;_ or
(cond
((eq #Choice "Primary")
(setq #Obj (entsel "\nSelect Primary object for VLA & DXF info: "))
)
((eq #Choice "Nested")
(setq #Obj (nentsel "\nSelect Nested object for VLA & DXF info: "))
)
) ;_ cond
(not (textscr))
(princ "\nVLA Info:\n\n")
(vlax-dump-object (vlax-ename->vla-object (car #Obj)) T)
(princ "\nDXF Info:\n")
(mapcar 'print (entget (car #Obj)))
) ;_ and
(princ)
) ;_ defun
|
|
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak... |
|
|
|
|
|
|
#6 | |
|
Super Member
![]() ![]() ![]() ![]() |
Quote:
I have something new for my toolbox. Thanks! |
|
|
|
||
|
|
|
|
|
#7 |
|
Super Member
![]() ![]() ![]() ![]() Using: Civil 3D 2009 Join Date: Apr 2008
Posts: 1,488
|
|
|
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak... |
|
|
|
|
|
|
#8 |
|
Super Member
![]() ![]() ![]() ![]() |
|
|
|
|
|
|
|
|
|
#9 | |
|
Super Member
![]() ![]() ![]() ![]() Using: Civil 3D 2009 Join Date: Apr 2008
Posts: 1,488
|
Quote:
I'm lazy so I always make sure I can stick everything in one nice little package.Dig through my subroutine thread, there's a lot of VLA subroutines in there. ![]() |
|
|
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak... |
||
|
|
|
|
|
#10 |
|
Super Member
![]() ![]() ![]() ![]() |
|
|
|
|
|
|
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Match text justification | kool130 | AutoCAD 2D Drafting, Object Properties & the Interface | 3 | 24th Feb 2009 12:15 pm |
| Text formatting - Justification settings in Properties text override | edwin | AutoCAD General | 7 | 20th Nov 2008 01:33 pm |
| Text - Justification Routine Help | ILoveMadoka | AutoLISP, VBA, the CUI & Customisation | 3 | 15th Nov 2008 12:17 am |
| text justification acad 2009 - which variable to alter? | sparklerach | AutoCAD General | 3 | 27th Aug 2008 03:32 pm |
| Attribute text justification | paulmcz | AutoCAD General | 6 | 25th Feb 2007 06:46 pm |