Force Dimension Text Not Working For Entmake

Force Dimension Text Not Working For Entmake

mgorecki
Collaborator Collaborator
1,253 Views
11 Replies
Message 1 of 12

Force Dimension Text Not Working For Entmake

mgorecki
Collaborator
Collaborator

Hello, I have a function that creates a dimension.  I supply the start and end points as well as the dimension location and dimension text.

The problem is when I pass the dimension text "2.325 (23X)" to the function, it creates a dimension with only "2.325".  Is there a way I can add a suffix to the text while using entmake?

Thanks

(defun CreateDim (startPnt endPnt dimLoc horORver txtVal)
 (if (= horORver "hor")
  (setq newStartPnt startPnt
	newEndPnt endPnt
	dimRot 0.0))
 (if (= horORver "ver")
  (setq newStartPnt endPnt
	newEndPnt startPnt
	dimRot 1.5708))
 (entmake
  (list
   (cons 0 "DIMENSION")
   (cons 1 txtVal)
   (cons 100 "AcDbEntity")
   (cons 100 "AcDbDimension")
   (cons 10 dimLoc) ;Dimension location
   (cons 11 dimLoc) ;Text location
   (cons 70 32)
   (cons 100 "AcDbAlignedDimension")
   (cons 13 newStartPnt)
   (cons 14 newEndPnt)
   (cons 50 dimRot)
   (cons 100 "AcDbRotatedDimension")
  )
 )
)
1,254 Views
11 Replies
Replies (11)
Message 2 of 12

mgorecki
Collaborator
Collaborator

Since I couldn't find a DXF code for a suffix, I went with "entmod".

So right after creating the dimension I used:

(setq lastDim (entlast))
(setq newDim (entget lastDim))
(setq newDim (subst (cons 1 cutoutPitch) (assoc 1 newDim) newDim ))
(entmod newDim)

Where cutoutPitch was the dimension value, with (23X) appended to it.

 

If anyone has a better way, feel free to share.

Message 3 of 12

cadffm
Consultant
Consultant

If you are searching for the suffix "property" ?

It is attached as xdata of application ACAD.

Check out the data of an dimension object with suffix-data by using ENTGET

 

(assoc -3 (entget (car(entsel))) '("*"))

 


(-3 >>>
"ACAD"
(1000 . "DSTYLE")
(1002 . "{")
(1070 . 3)
(1000 . "-->MySuffix")
(1002 . "}")
) <<<

 

 

You can entmake DIM incl. the suffix with this knowledge now.

Sebastian

Message 4 of 12

mgorecki
Collaborator
Collaborator

I created a dimension using a suffix.  Then I used the command:

(assoc -3 (entget (car(entsel))) '("*"))

and selected my dimension.  It came back with "; error: too many arguments"

I'm guessing that it's because I didn't use XDATA to attach the suffix.  I was hoping, it would be attached just by adding it to the dimension format.

I also tried adding that section to the entmake in my function, but I just get:

bad function in expression: (-3 "ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 3) (1000 . "-->MySuffix") (1002 . "}"))

I'm probably not using it correctly.  Any ideas how I can get that to work?

 

 

Message 5 of 12

cadffm
Consultant
Consultant

>and selected my dimension. It came back with

"; error: too many arguments"

 

You should know about these basics things, how the right syntax is!?  Sorry.

 

 

>I also tried adding that section to the entmake in my function, but I just get:

"bad function in expression:"

 

Okay,Now it is clear: You lack a lot of basic knowledge

Nothing to do with dimension and entmake, this are more basic things.


I did not expect that when someone created dimensions about entmake - my wrong assumption.

I currently have no time for such novice problems, so only in examples:

 

(assoc -3 (entget (car(entsel)) '("*")))

 

and

 

(entmake
'(
	(0 . "DIMENSION")
	(100 . "AcDbEntity")
	(8 . "0")
	(100 . "AcDbDimension")
	(280 . 0)
	(10 10.0 8.50 0.0)
	(11 25.0 10.0 0.0)
	(12 0.0 0.0 0.0)
	(70 . 32)
	(1 . "")
	(71 . 5)
	(72 . 1)
	(41 . 1.0)
	(42 . 5.0)
	(73 . 0)
	(74 . 0)
	(75 . 0)
	(52 . 0.0)
	(53 . 0.0)
	(54 . 0.0)
	(51 . 0.0)
	(210 0.0 0.0 1.0)
	(100 . "AcDbAlignedDimension")
	(13 5.0 5.0 0.0)
	(14 10.0 5.0 0.0)
	(15 0.0 0.0 0.0)
	(16 0.0 0.0 0.0)
	(40 . 0.0)
	(50 . 0.0)
	(100 . "AcDbRotatedDimension")
	(-3 ("ACAD"(1000 . "DSTYLE")(1002 . "{")(1070 . 3)(1000 . "MyTestSuffix")(1002 . "}")))
 )
)

 

 

Sebastian

0 Likes
Message 6 of 12

cadffm
Consultant
Consultant

Sorry, i am in hurry and it is hot here, hope it helps - anyway.

Sebastian

0 Likes
Message 7 of 12

mgorecki
Collaborator
Collaborator

Thank you for your help, but I have one last question.

How do I get this to work, if "suffixText" can be different each time it's run?

I did change it a little so that I could use variables, and I tried a number of ways with the (-3... section, but could not get it to work.

(entmake
  (list
   '(0 . "DIMENSION")
   '(100 . "AcDbEntity")
   '(100 . "AcDbDimension")
   '(280 . 0)
    (cons 10 dimLoc)
    (cons 11 dimLoc)
   '(12 0.0 0.0 0.0)
   '(70 . 32)
   '(1 . "")
   '(71 . 5)
   '(72 . 1)
   '(41 . 1.0)
   '(42 . 5.0)
   '(73 . 0)
   '(74 . 0)
   '(75 . 0)
   '(52 . 0.0)
   '(53 . 0.0)
   '(54 . 0.0)
   '(51 . 0.0)
   '(210 0.0 0.0 1.0)
   '(100 . "AcDbAlignedDimension")
    (cons 13 newStartPnt)
    (cons 14 newEndPnt)
   '(15 0.0 0.0 0.0)
   '(16 0.0 0.0 0.0)
   '(40 . 0.0)
    (cons 50 dimRot)
   '(100 . "AcDbRotatedDimension")
   '(-3 ("ACAD"
         (1000 . "DSTYLE")
         (1002 . "{")
         (1070 . 3)
         (1000 . "suffixText")
         (1002 . "}")))
  )
 )

I know you're busy, and I'm thankful for your help.  Also, I know (1000 . "suffixText") will not work, I just left it to show I need to use a variable there.

0 Likes
Message 8 of 12

cadffm
Consultant
Consultant

lispfunction LIST

 

untested:

 

(-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 3) (1000 . "VySuffVal") (1002 . "}")))

 

(list -3
   (list "ACAD"
      '(1000 . "DSTYLE")
      '(1002 . "{")
      '(1070 . 3)
     (cons 1000 suffixTextvaluevariable)
    '(1002 . "}")
  )
)

 

(entmake
(list
'(0 . "DIMENSION")
'(100 . "AcDbEntity")
'(100 . "AcDbDimension")
'(280 . 0)
(cons 10 dimLoc)
(cons 11 dimLoc)
'(12 0.0 0.0 0.0)
'(70 . 32)
'(1 . "")
'(71 . 5)
'(72 . 1)
'(41 . 1.0)
'(42 . 5.0)
'(73 . 0)
'(74 . 0)
'(75 . 0)
'(52 . 0.0)
'(53 . 0.0)
'(54 . 0.0)
'(51 . 0.0)
'(210 0.0 0.0 1.0)
'(100 . "AcDbAlignedDimension")
(cons 13 newStartPnt)
(cons 14 newEndPnt)
'(15 0.0 0.0 0.0)
'(16 0.0 0.0 0.0)
'(40 . 0.0)
(cons 50 dimRot)
'(100 . "AcDbRotatedDimension")
(list -3
(list "ACAD"
'(1000 . "DSTYLE")
'(1002 . "{")
'(1070 . 3)
(cons 1000 suffixTextvaluevariable)
'(1002 . "}")
)
)
)
)

 

 

Sebastian

0 Likes
Message 9 of 12

mgorecki
Collaborator
Collaborator

Well I tried so many different variations and couldn't get it to work, but thank you anyway for your help.  I hope it cools off soon where you are.  I'm in Arizona, it's summer, and it's usually over 100 deg F.  Sometimes it gets up to 120 deg F so I can understand how you feel.

0 Likes
Message 10 of 12

scot-65
Advisor
Advisor
I, too, have run into this situation.
Instead of fussing with it, I used entlast/entnext
and setpropertyvalue after the entmod.

Have you tried "<> MySuffix" on DFX 1?

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 11 of 12

mgorecki
Collaborator
Collaborator

Hi Scot, I did try the "<> MySuffix", but it didn't work.

 

I ended up just going back to using the entlast/entmod method that I posted earlier.  

 

0 Likes
Message 12 of 12

john.uhden
Mentor
Mentor

In my several years of experience, I have found that entmod does not work on various entities.

Time to get used to ActiveX properties, as in...

(VLAX-PUT OBJECT 'TEXTOVERRIDE "HELP")

How simple is that, eh?

John F. Uhden

0 Likes