Jump to content

Recommended Posts

Posted

Hi guys,

 

I need help!

 

How can I EXPLODE a polyface MESH to 3D Face BUT keep original colors. I would appreciate it if you help me to solve the problem. DWG file attached.

 

Kind Regards,

Mirzali Jafarov

Profile IP Line01.dwg

Posted

As Far As I know :

 

It can be done, but not with AutoCAD's standard tools.

 

I don't know what program created the mesh and or converted into AutoCAD's PFace format, but I do know it

used many non standard values.

 

Is true color a must or can ACAD's ACI be suffecient ?

 

-David

Posted

It was created by voxler. I contacted them but nothing for now.

 

Actually, doesn't matter which type of color it should be. All I want is to see same color in both voxler and autocad.

 

-Mirzali

Posted

In Autolisp, you can extract the layer or color data and create a new faces based on the mesh data:

 

 

I know next to nothing about RGB colr, so this uses AutoCAD ACI Colors.

 

The moderators may move this thread to the the autolisp section of the forum.

 

[b][color=BLACK]([/color][/b]defun c:pf-facec [b][color=FUCHSIA]([/color][/b]/ en p pl ss ed vn vd c
                    f1 s1 p10 f2 s2 p11 f3 s3 p12 f4 s4 p13[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq p 1[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not en[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]princ [color=#2f4f4f]"\nSelect [b][color=GREEN]([/color][/b]1[b][color=GREEN])[/color][/b] PFACE Mesh..."[/color][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ss [b][color=GREEN]([/color][/b]ssget [b][color=BLUE]([/color][/b]list [b][color=RED]([/color][/b]cons 0 [color=#2f4f4f]"POLYLINE"[/color][b][color=RED])[/color][/b][b][color=RED]([/color][/b]cons 70 64[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]= [b][color=GREEN]([/color][/b]sslength ss[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq ed [b][color=NAVY]([/color][/b]entget en[b][color=NAVY])[/color][/b]
       vn [b][color=NAVY]([/color][/b]entnext en[b][color=NAVY])[/color][/b]
       vd [b][color=NAVY]([/color][/b]entget vn[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]princ [color=#2f4f4f]"\nReading Faces ... \n"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]= [color=#2f4f4f]"VERTEX"[/color] [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 0 vd[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]cond [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= 192 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 70 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq pl [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cons [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"P"[/color] [b][color=TEAL]([/color][/b]itoa p[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b]
                                    [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 10 vd[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] pl[b][color=BLUE])[/color][/b]
                      p [b][color=BLUE]([/color][/b]1+ p[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= 128 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 70 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq f1 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 71 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                     s1 [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp f1[b][color=RED])[/color][/b] 1 0[b][color=BLUE])[/color][/b]
                    p10 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"P"[/color] [b][color=TEAL]([/color][/b]itoa [b][color=OLIVE]([/color][/b]abs f1[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] pl[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq f2 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 72 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                     s2 [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp f2[b][color=RED])[/color][/b] 2 0[b][color=BLUE])[/color][/b]
                    p11 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"P"[/color] [b][color=TEAL]([/color][/b]itoa [b][color=OLIVE]([/color][/b]abs f2[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] pl[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq f3 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 73 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                     s3 [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp f3[b][color=RED])[/color][/b] 4 0[b][color=BLUE])[/color][/b]
                    p12 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"P"[/color] [b][color=TEAL]([/color][/b]itoa [b][color=OLIVE]([/color][/b]abs f3[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] pl[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq f4 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 74 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                     s4 [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp f4[b][color=RED])[/color][/b] 8 0[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]zerop f4[b][color=BLUE])[/color][/b]
                   [b][color=BLUE]([/color][/b]setq f4 f3
                         s4 8[b][color=BLUE])[/color][/b]
                   [b][color=BLUE]([/color][/b]setq s4 s3[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]setq p13 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"P"[/color] [b][color=TEAL]([/color][/b]itoa [b][color=OLIVE]([/color][/b]abs f4[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] pl[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]

               [b][color=GREEN]([/color][/b]setq c [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]assoc 62 vd[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 62 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] 256[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]princ [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"\t\t\r"[/color] [b][color=RED]([/color][/b]itoa f1[b][color=RED])[/color][/b] [color=#2f4f4f]" "[/color] [b][color=RED]([/color][/b]itoa f2[b][color=RED])[/color][/b] [color=#2f4f4f]" "[/color] [b][color=RED]([/color][/b]itoa f3[b][color=RED])[/color][/b] [color=#2f4f4f]" "[/color] [b][color=RED]([/color][/b]itoa f4[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
               [b][color=GREEN]([/color][/b]entmake [b][color=BLUE]([/color][/b]list [b][color=RED]([/color][/b]cons 0 [color=#2f4f4f]"3DFACE"[/color][b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]assoc 8 vd[b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 62 c[b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 70 [b][color=PURPLE]([/color][/b]+ s1 s2 s3 s4[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 10 p10[b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 11 p11[b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 12 p12[b][color=RED])[/color][/b]
                              [b][color=RED]([/color][/b]cons 13 p13[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq vn [b][color=MAROON]([/color][/b]entnext vn[b][color=MAROON])[/color][/b]
              vd [b][color=MAROON]([/color][/b]entget vn[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

You will need to run this on each PFACE mesh in the drawing ( your sample has (2) meshes )

 

 

There is a tutorial on how to load an AutoLISP routine on the site.

 

Somehow you meshes referenced a face index number of 0. In the past, all face indexes started with number 1.

 

HTH -David

Posted

Thank you for your assistance. I have already handled issue with standard AutoCAD tools.

 

I created mesh from polyface mesh by using "Mesh Tessellation Options". It seemed to ignore all the colors but after exploding it all the original colors came back and perfect 3D face object as a result.

 

-Mirzali

Posted

I'm glad you found an answer. -David

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...