Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help Setting LinetypeScale to Feature Line via Lisp

6 REPLIES 6
Reply
Message 1 of 7
CodeDing
298 Views, 6 Replies

Help Setting LinetypeScale to Feature Line via Lisp

Hello all,

 

It seems that I cannot properly set the LinetypeScale of a Feature Line (the one that shows up in the Properties palette, NOT the feature line Style) via Lisp. I'll post some screenshots and code below, but it appears that SOMEHOW whenever I use a code to SET the LinetypeScale property, it ROUNDS my number before applying it to the entity. [ex. 1.2-> 1.0, 1.7->2.0, 0.2->0.0, 0.7->1.0].

 

Any help on this? I can't find it being mentioned before. I would really like to be able to keep this in Lisp, but any thoughts or input on the matter is appreciated. I have also attached the dwg (2018 version) for your testing.

 

Best,

~DD

 

[P.S. I have also tried (entmod ...) to no avail]

 

Original Feature Line, before code edits:

Original Feature LineOriginal Feature Line

 

Now, when I apply EITHER of the two following codes...

 

(vlax-put-property
  (vlax-ename->vla-object (car (entsel "Select Feature Line")))
  'LinetypeScale
  0.2
)

(vla-put-LinetypeScale
  (vlax-ename->vla-object (car (entsel "Select Feature Line")))
  0.2
)

 

 

...I receive the Property on the Left image. Whereas when I MANUALLY change it, I get the Property on the Right image:

Left: After applying code / Right: After applying manuallyLeft: After applying code / Right: After applying manually

 

Likewise, when I apply either of these two codes...

 

(vlax-put-property
  (vlax-ename->vla-object (car (entsel "Select Feature Line")))
  'LinetypeScale
  1.7
)

(vla-put-LinetypeScale
  (vlax-ename->vla-object (car (entsel "Select Feature Line")))
  1.7
)

 

 

...I receive the following (Left is after code input, Right is after Manual input):

image.png

 

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
6 REPLIES 6
Message 2 of 7
hosneyalaa
in reply to: CodeDing

hi

try

Can you change LinetypeScale from the style Feature Line 

 

Annotation 2022-09-26 072452.png

Message 3 of 7
CodeDing
in reply to: hosneyalaa

@hosneyalaa ,

 

Yes, I can, but that is not the issue my post is trying to resolve.

 

Best,

~DD

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 4 of 7
hosneyalaa
in reply to: CodeDing

 

TRY

;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-linetype-scales/td-p/8179790

(defun c:ltschange ( / doc scl )
    (initget 6)
    (if (setq scl (getreal "\nSpecify new linetype scale: "))
        (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
            (if (= :vlax-false (vla-get-isxref blk))
                (vlax-for obj blk
                    (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
                        (vla-put-linetypescale obj scl)
                    )
                )
            )
        )
    )
    (vla-regen doc acallviewports)
    (princ)
)
Message 5 of 7
CodeDing
in reply to: hosneyalaa

@hosneyalaa ,

 

I receive the same result as if running my original code. See image below.

 

Best,

~DD

 

image.png

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 6 of 7
hippe013
in reply to: CodeDing

As to why it is rounding the lintypescale, I have no idea, it's anybody's guess, and may even be a bug. Though, why are you trying to set the linetype scale directly on the entity when it appears that it has no effect on the display of the linetype? As it was pointed out, it is controlled by the featureline style. Now, as far as your drawing goes, and everybody does things differently, but the first thing that I checked was the values of LTSCALE, PSLTSCALE, and MSLTSCALE. 

Message 7 of 7
CodeDing
in reply to: hippe013

@hippe013 ,

 

As to why it is rounding the lintypescale, I have no idea, it's anybody's guess, and may even be a bug. 


Yeah, at this point, I'm just probably going to chalk it up as a lost cause.

 


Though, why are you trying to set the linetype scale directly on the entity when it appears that it has no effect on the display of the linetype?

If a Feature Line is ever exploded to a 3D Polyline, the LT Scale transfers with it, so I am trying to account for that possibility... Now, I do understand that the workflow of a user to change LTScale of a Feature Line then explode to a 3D Polyline would be miniscule AT BEST, but I was still trying to account for it, nonetheless. I've seen crazier workflows...

 

Now, as far as your drawing goes, and everybody does things differently, but the first thing that I checked was the values of LTSCALE, PSLTSCALE, and MSLTSCALE. 

Yeah, one of my templates has an LTSCALE that is set to 25.4 to account for some Imperial/Metric Linetype conversions.

 

 

If I find anything in the meantime, I'll come back to mention it, but there does not seem to be a direct solution to my original question at this time. Anyway, thank you guys for looking into this.

 

Best,

~DD

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report