Change Featureline style by lisp (Revisited from a 2013 post)

Change Featureline style by lisp (Revisited from a 2013 post)

rgrainer
Collaborator Collaborator
722 Views
3 Replies
Message 1 of 4

Change Featureline style by lisp (Revisited from a 2013 post)

rgrainer
Collaborator
Collaborator

This was originally posted in 2013:
https://forums.autodesk.com/t5/civil-3d-customization/change-feature-line-style-in-lisp/td-p/4557391

I didn't want to add to that old thread so I made this new one, hope that isn't against the rules.


I'm in the same boat and would like to find a way to change featureline styles through a lisp function.


Back then someone from Adesk said it can be done by one line through .NET, because apparently it can't be done directly through lisp. So after all this time I would like to know if that is still the case? Can it be done with lisp or do I have to learn .NET to make this happen.
Thanks

0 Likes
Accepted solutions (2)
723 Views
3 Replies
Replies (3)
Message 2 of 4

Jeff_M
Consultant
Consultant
Accepted solution

@rgrainer creating a new post as you did is much preferable to adding on to an old thread. Adding the link back to the original is a definite plus. You still need a .NET helper tool to do this in lisp. The good news, for you, is that you don't need to learn.NET. Just download the attached zip file, browse to where you saved it, rt. click the zip, select Properties, go to the General tab, near the bottom will likely be a checkbox to Unblock the zip. Check that, then Apply and OK. Now unzip the dll in the zip to a trusted location in the AutoCAD paths. Use Netload to load the dll into C3D, then use a lisp similar to the following, replacing the stylename with whatever you wish.

 

(defun C:ChangeStyle (/ FLLINE FLOBJECT NEWSTYLE)
  (Setq FLLine (car (entsel "\nSelect FeatureLine to change style: ")))
  (setq FLObject (vlax-ename->vla-object FLLine))
  (setq newstyle "Corridor Crown")
  (FLStyleSetLisp (vlax-get FLObject 'Handle) newstyle)
  (princ)
)  

 

Note that the attached DLL was compiled using the C3D 2018 references, so should work in all newer versions of C3D. I also used the c# code as posted to that original 2013 post, if anyone wants to see the source code.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 4

rgrainer
Collaborator
Collaborator
Accepted solution

Oh my goodness. This is hugely awesome. Thanks so much Jeff. This not only makes my day, but my year (so far) as well. Your many functions that I've found around various boards, over time, have always been a big help to me and this one is no exception.

Thanks again.
I owe you a pitcher.

0 Likes
Message 4 of 4

RandyBenson
Advocate
Advocate

Nice!

Thanks, Jeff.

0 Likes