The Display Classes in Layer to Autocad

Hello

With Prostructures, when creating an acis model to share with the client or project engineer responsible for the project
it would be good to be able to divide the structure on autocad layers with the same names in Display Classes

example columns in column layers
beams in layer beams etc..

this would certainly make it easier for the responsible designer to consult

to do this you would need to read the class names
create layers in autocad
turn off all classes
activate one class at a time, create solids acis
and place the class elements in the layer with the class name.

I ask is it possible to create a macro that does this?

I only know autolisp or visual lisp
I consulted the com functions but I can't find how to read class names in display class

can someone help

Thank you

Parents
  • here is the working lisp,
    you need to hide all objects which are not solid of prosteel like grid, lines, texts etc
    you create the layers that will be white in color in layer assign the color you want

    the commands Autocad are in Italian and will have to be modified in your language

    ciao

    (defun LM:Unique ( l ); Thanks to www.lee-mac.com/programs.html
    (if l (cons (car l) (LM:Unique (vl-remove (car l) (cdr l)))))
    );defun
    (defun c:LayerDisplayClass ( / ); acadapp shapeinfo ss n_ogg DisplayClassName
    (vl-load-com)
    (setq ListDC nil listDCU nil)
    (setq acadapp (vlax-get-acad-object))
    (setq shapeinfo (vla-getinterfaceobject acadapp "PSCOMWRAPPER.Ks_ComShapeInfo" ))
    (setq ss (ssget))
    (setq n_ogg (sslength ss))
    (setq count 0)
    (setq ent (ssname ss count ))
    (setq shapeinfo (vlax-ename->vla-object ent))
    (princ "\nYou need to hide all objects which are not solid of prosteel like grid, lines, texts etc.. \n")
    (setq DisplayClassName (vlax-get-property shapeinfo 'DisplayClassName))
    (setq ListDC (list DisplayClassName))
    (repeat (- n_ogg 1)
    (setq count (+ count 1))
    (setq ent (ssname ss count ))
    (setq shapeinfo (vlax-ename->vla-object ent))
    (setq DisplayClassName (vlax-get-property shapeinfo 'DisplayClassName))
    (setq ListDC (append listDC (list DisplayClassName)))
    );repeat
    (setq ListaLayer (LM:unique listDC))
    (setq n_layer (length ListaLayer))
    (setq count 0)
    (Command "-Layer" "N" (nth count ListaLayer)"")
    (Repeat (- n_layer 1)
    (setq count (+ count 1))
    (Command "-Layer" "N" (nth count ListaLayer)"")
    )
    (princ)(princ)(princ)
    (setq n_ogg (sslength ss))
    (setq count 0)
    (setq ent (ssname ss count ))
    (setq shapeinfo (vlax-ename->vla-object ent))
    (setq DisplayClassName (vlax-get-property shapeinfo 'DisplayClassName))
    (command-s "_cambia" ent "" "P" "La" DisplayClassName "")
    (repeat (- n_ogg 1)
    (setq count (+ count 1))
    (setq ent (ssname ss count ))
    (setq shapeinfo (vlax-ename->vla-object ent))
    (setq DisplayClassName (vlax-get-property shapeinfo 'DisplayClassName))
    (command-s "_cambia" ent "" "P" "La" DisplayClassName "")
    )(princ)(princ)(princ)
    )

  • Hello Carry 

    It not working for me . Could you tell me what I do wrong. Thx

    "Layer "EXISTING_TRUSS" already exists.
    Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]:
    Command: ; error: Unknown (command-s) failure."

  • HI
    I don't know which version of Autocad and Prostructures you use.
    I don't even know what Layer configuration you use.
    If you write the lisp code here and point out where the error is, maybe I can help you.
    I can give you some advice:
    Make a copy of the model you want to export in acis.
    Clear all layers that are not from Prostructures.
    Leave only the solid Prostructure layers of profiles and plates and bolts.

    Command: ; error: Unknown (command-s) failure."
    Try removing the -s and just leave command.
    Replace _change with Change
    Let me know


    sorry for my bad English

    Answer Verified By: Johannes Michalowsky 

Reply Children
No Data