Entmake a dimstyle, specifying font

Entmake a dimstyle, specifying font

Anonymous
Not applicable
974 Views
13 Replies
Message 1 of 14

Entmake a dimstyle, specifying font

Anonymous
Not applicable

Hi!

 

I am trying to create a dimstyle with entmake. But im struggling with the fontstyle. The dxf chart says:

 340 - DIMTXSTY (handle of referenced STYLE)

 

But I cant seem to find the handle of a textstyle entry. How can i specify a font to a dimstyle with entmake? (normal AutoLISP only, no visual lisp if it's possible!)

 

Thx in advance

 

0 Likes
Accepted solutions (2)
975 Views
13 Replies
Replies (13)
Message 2 of 14

diagodose2009
Collaborator
Collaborator

You must share here, s SampleDRawgin.dwg. All DimStyle exists infininity number in entire Internet.

If you need entmake then you save "SampleDrawing.dwg" as version autocad2004.

bigfoot_clGreenForest.jpg

0 Likes
Message 3 of 14

Kent1Cooper
Consultant
Consultant
Accepted solution

You don't specify a font in a Dimension Style.  You specify a Text Style, and the font is specified in that.  The thing associated with 340 in the Dimension Style's entity data is the entity name of the Text Style table entry for the Style.

 

Try using [untested]:

 

(cons 340 (tblobjname "style" "YourTextStyleName"))

Kent Cooper, AIA
Message 4 of 14

Anonymous
Not applicable

It worked, thank you! 🙂

0 Likes
Message 5 of 14

Anonymous
Not applicable

Well, sorry for being noob, but now the "oblique" arrowhead doesnt want to work.

 

Im looking this: 

https://help.autodesk.com/view/ACD/2021/ENU/?guid=GUID-F2FAD36F-0CE3-4943-9DAD-A9BCD2AE81DA

 

Here it says: 

5, 6, 7th group codes are obsolete, now object ID

 

Yet if i try to tablesearch the dimstyle I want to recreate with entmake, the 5th group code is "Oblique" the 6th and 7th is ""

 

So since it was written its obsolete, Im trying to set the 341, 342, 343, 344th codes  instead to "_OBLIQUE"  but it doesnt let me.

 

Here it says "_OBLIQUE" is what i should write (with a "_" at the beginning.

https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/Au...

 

But no matter what i try (i tried with the 5, 6, 7th group codes too but nothing.

 

Any idea?

 

I attached a dwg, it has the dimstyle im trying to recreate with entmake.

Thanks!

 

0 Likes
Message 6 of 14

Sea-Haven
Mentor
Mentor

Removed looking in different direction

0 Likes
Message 7 of 14

Anonymous
Not applicable

Yeah that would give me the props of the dimension object not the dimstyle. But I used (tblsearch "dimstyle" "500_méretezés") and basically copyed the same dxf codelist as it gave me and still it doesn't work! 

0 Likes
Message 8 of 14

Anonymous
Not applicable

I will copy the code here what I have  as soon as I get in my office. 

0 Likes
Message 9 of 14

Anonymous
Not applicable

So here is the code what i have so far, but the "oblique" arrowheadstyle  doesnt work. And it doesnt let me set anything to the codes 341, 342, 343, 344.

 

(entmake
(list
(cons 0 "DIMSTYLE")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbDimStyleTableRecord")
(cons 2 "500_méretezés2")
(cons 70 0)
(cons 3 "")
(cons 4 "")
(cons 5 "Oblique")
(cons 6 ""
(cons 7 "")
(cons 40 0.0)
(cons 41 2.0)
(cons 42 0.625)
(cons 43 0.38)
(cons 44 0.18)
(cons 45 0.0)
(cons 46 0.0)
(cons 47 0.0)
(cons 48 0.0)
(cons 140 1.5)
(cons 141 0.0)
(cons 142 0.0)
(cons 143 25.4)
(cons 144 -1.0)
(cons 145 0.0)
(cons 146 1.0)
(cons 147 0.8)
(cons 71 0)
(cons 72 0)
(cons 73 0)
(cons 74 0)
(cons 75 0)
(cons 76 0)
(cons 77 1)
(cons 78 0)
(cons 79 0)
(cons 170 0)
(cons 171 2)
(cons 172 1)
(cons 173 0)
(cons 174 0)
(cons 175 0)
(cons 176 0)
(cons 177 0)
(cons 178 0)
(cons 270 2)
(cons 271 1)
(cons 272 1)
(cons 273 2)
(cons 274 2)
(cons 275 0)
(cons 280 0)
(cons 281 0)
(cons 282 0)
(cons 283 1)
(cons 284 0)
(cons 285 0)
(cons 286 0)
(cons 287 3)
(cons 288 0)
(cons 289 0)
(cons 340 "ISO")
);list
);entmake

0 Likes
Message 10 of 14

Anonymous
Not applicable

Ah sorry the last code is  (cons 340 (tblobjname "style" "ISO")) and i cant edit my previous post anymore.

0 Likes
Message 11 of 14

Anonymous
Not applicable
Accepted solution

Progress: could have made it!

I needed to use for the 34x codes this:

(cdr (assoc 330 (entget (tblobjname "block" "_Oblique"))))

0 Likes
Message 12 of 14

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... it doesnt let me set anything to the codes 341, 342, 343, 344. ....


[EDIT:  I hadn't seen Message 11 as I first wrote this -- it looks like you may have the approach, but see the "possible problem" below, which could be the cause of the no-arrows result.]

 

Assuming it works the same way as with the Text Style, try this:

 

(cons 341 (tblobjname "block" "YourLeaderBlockName"))

(cons 342 (tblobjname "block" "YourDimArrowBlockName"))

 

One possible problem [untested] is that the Block may not be in the drawing, and I'm not sure whether it will just find them.  You may need to first manually do something using the arrow Block you want, to bring it in.

 

If you don't need different arrows at the two ends, you shouldn't need 343 or 344.

Kent Cooper, AIA
0 Likes
Message 13 of 14

Anonymous
Not applicable

Yes @Kent1Cooper, i have noticed this code

 

 

 

(entmake	(list   
			(cons 0 "DIMSTYLE");object type
			(cons 100 "AcDbSymbolTableRecord");subclass marker
			(cons 100 "AcDbDimStyleTableRecord");subclass marker
			(cons 2 "500_autodim_kábel2");name
			(cons 70 0) ;xref flag
			(cons 3 "") ;suffix
			(cons 40 1.0);global scaling
			(cons 41 1.0);size of the dimblocks
			(cons 42 0.65);extensionline offset from basepoints
			(cons 44 0.2);extension of the extensionlines beyond the dimensionline
			(cons 45 0.0);primary unit rounding
			(cons 46 0.0);extension of the dimensionline beyond the extensionlines
			(cons 140 1.5);text height
			(cons 144 1.0);primary scale factor
			(cons 145 0.8);text offset from dimension line
			(cons 73 0);text alignment
			(cons 74 0);text alignment
			(cons 77 0);dimtext position (DIMTAD)
			(cons 172 1);forcing dimension lines to be drawn between extension lines
			(cons 173 0);dim blocks according to dimblk
			(cons 270 2);primary unit for primary linear dimensions
			(cons 271 1);primary decimal places
			(cons 275 0);decimal format for angular dimensions
			(cons 279 0);moving attitude
			(cons 280 0);text position
			(cons 287 3);
			(cons 289 3);attitude
			(cons 340 (tblobjname "style" "ISO"));font
			(cons 342 (cdr (assoc 330 (entget (tblobjname "block" "_Oblique")))));dimblok type
			(cons 371 -1);din lineweight bylayer
			(cons 372 -1);ext lineweight bylayer
			);list
	)
)

 

 

 

works ONLY if there is already a similar dimstyle in the drawing, otherwise it is giving me "lentitype error".

I dont understand because after the creation of it (with commented out 342 code), the program let me manually change the arrowhead type to "oblique" in the menu without any problem wtf. But i couldnt find the dimstyle-arrowhead changing possibility in the dimstyle commandline version so i cant change it afterward with autolisp. So how can i import this "_oblique" block before entmake the dimstyle and where is this block stored internally? If the drawing has this block already in usage by a different dimstyle with oblique style, the code above works...

 

GOSH I cant believe i am suffering with a so simple freaking task for 3 days, why does it have to be everything so complicated with autocad??!😫

0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

I remember doing something like this and had lots of problems the end way around was make it then change the value. Some of the extended values are just hard to get at.

 

(vla-put-arrowhead1type (vlax-ename->vla-object (entlast)) 5) ; note need arrowhead2type and 5 is "Oblique" count from top "Arrow solid fill"

 

 

0 Likes