<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>tema Re: AutoCAD - Creating 3D from 2D polygons height attribute? en AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953733#M106815</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created now 3D-Solids between attributes ABSHMIN and ABSHMAX, I hope that is what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/206975i361104DF577AE03F/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="2015-12-16 13-13-41.png" title="2015-12-16 13-13-41.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code (VBA, so maybe installing the VBA Enabler for AutoCAD is required) which does this (only done for exact this drawing structure) can be found here:&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;LI-SPOILER&gt;&lt;BR /&gt;
&lt;PRE&gt;Option Explicit

Public Sub ExtToAttHeight()
   Dim tEnt As AcadEntity
   For Each tEnt In ThisDrawing.ModelSpace
      If TypeOf tEnt Is AcadBlockReference Then
         Call handleBlockRef(tEnt)
      End If
   Next
End Sub

Private Sub handleBlockRef(ByRef BlRef As AcadBlockReference)
   If BlRef.HasAttributes Then
      Dim tH1 As Double: tH1 = -1
      Dim tH2 As Double: tH2 = -1
      Dim tAtts As Variant: tAtts = BlRef.GetAttributes
      Dim i As Integer
      For i = LBound(tAtts) To UBound(tAtts)
         Select Case UCase(tAtts(i).TagString)
            Case "ABSHMIN": tH1 = Val(tAtts(i).TextString)
            Case "ABSHMAX": tH2 = Val(tAtts(i).TextString)
         End Select
         If (tH1 &amp;gt;= 0) And (tH2 &amp;gt;= 0) Then Exit For
      Next
      If (tH1 &amp;gt;= 0) And (tH2 &amp;gt;= 0) Then
         'ok, there exits valid data
         Dim tBlDef As AcadBlock: Set tBlDef = ThisDrawing.Blocks(BlRef.Name)
         Dim tEnt As AcadEntity
         For Each tEnt In tBlDef
            'search polyline within the blockdefinition
            If (TypeOf tEnt Is AcadPolyline) Or (TypeOf tEnt Is AcadLWPolyline) Then
               Dim tCurves(0) As AcadEntity: Set tCurves(0) = tEnt
               Dim tRegion As AcadRegion: Set tRegion = tBlDef.AddRegion(tCurves)(0)
               'create solid and move it to base-elevation
               Dim tSolid As Acad3DSolid: Set tSolid = tBlDef.AddExtrudedSolid(tRegion, tH2 - tH1, 0#)
               Dim tPnt1(0 To 2) As Double
               Dim tPnt2(0 To 2) As Double: tPnt2(2) = tH1
               Call tSolid.Move(tPnt1, tPnt2)
               tRegion.Delete
               'Exit For
            End If
         Next
      End If
   Else
      'nothing to do
   End If
End Sub
&lt;/PRE&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;/LI-SPOILER&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;The finished drawing can be downloaded from &lt;A href="http://www.hollaus.at/weblinksend/WebLinkSend.asmx/Download?ID=cb80f980-1aee-47f0-ae9e-32c80ca2d734" target="_self"&gt;&amp;gt;&amp;gt;&amp;gt;here&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;There is one object extruded down to Z=0 .. because there the attribues are not filled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2015 12:19:32 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2015-12-16T12:19:32Z</dc:date>
    <item>
      <title>AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952541#M106727</link>
      <description>&lt;DIV&gt;Hi All,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Doing a bit of work for my urban planning course. Wanted a 3-d model to do some visuals for an area in the city that is going to be redeveloped. I have a bunch of data that the local authority shared with me that includes polygons and building height data, which I've since exported from MapInfo as a .dxf retaining the attributes for building height. MapInfo had it as a 2d drawing but ideally I'd like to somehow (if it's possible?) instruct AutoCad to turn said polygons into 3D blocks using the attribute data I have. Each polygon has this data but I can't for the life of me figure out how to progress from here.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Ultimately I'd like to export it to import into sketchup to do some simple editing (so I've understood I need to avoid making the faces be hatched and instead be regions?). Any help here would be immensely appreciated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sorry, I'm a bit basic at all of this and am rather muddling my way through! Screenshot attatched.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;C&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 Dec 2015 17:31:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952541#M106727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-15T17:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952650#M106736</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;&amp;gt;&amp;gt; turn said polygons into 3D blocks&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Can you upload the drawing so we can look how the objects are defined?&lt;/P&gt;
&lt;P&gt;Because what you selected are block-insertions and not polygons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2015 18:23:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952650#M106736</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-12-15T18:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952678#M106739</link>
      <description>Ah I apologise, my terminology is pretty awful when it comes to this. I'll&lt;BR /&gt;upload it when I'm back this evening late.</description>
      <pubDate>Tue, 15 Dec 2015 18:34:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5952678#M106739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-15T18:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953686#M106807</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file is to large to directly attatch so have uploaded it to dropbox: &lt;A href="https://www.dropbox.com/s/5bl5i92fp2a4pg4/ModifiedBuidlingHeighData.dxf?dl=0&amp;nbsp;" target="_blank"&gt;https://www.dropbox.com/s/5bl5i92fp2a4pg4/ModifiedBuidlingHeighData.dxf?dl=0&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any advice/help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 11:36:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953686#M106807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-16T11:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953693#M106808</link>
      <description>&lt;P&gt;Personally, I would extrude each building up to the desired height. Problem is AutoCAD has no way of knowing that you want said polygon at said height as it's just a shape, if it was&amp;nbsp;made into&amp;nbsp;a named&amp;nbsp;block&amp;nbsp;it *might* have been able to find it and move it to a position in the Z axis, but then you would need to block each building and then probably make a table for the data to be read, probably 20x more work than just extruding each building. Good luck!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Emma Cronin&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 11:44:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953693#M106808</guid>
      <dc:creator>emma.cronin</dc:creator>
      <dc:date>2015-12-16T11:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953702#M106810</link>
      <description>&lt;P&gt;Ah blast, so there's no way to make AutoCAD take the attribute associated with each block? I only ask because you said AutoCAD doesn't know what height I want it but each shape has an attribute (referred to as RelHMax which is the maximum height of the structure) that is different per each block. You'll see in my screenshot that it says *VARIES* because each block has this attribute where I imported it from a MapInfo file using their universal translator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(If it helps the ToID Attribute is a unique identifier to each block?)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 11:57:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953702#M106810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-16T11:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953715#M106813</link>
      <description>&lt;P&gt;Oh yes! Sorry! Clearly I need to look closer next time! Someone here may be able to produce a macro to interporate the data, I have personally always had issues getting CAD to make sense of data extraction, and gave up due to being impatient!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck, hope someone can give you the answer you are looking for!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Emma Cronin&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 12:05:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953715#M106813</guid>
      <dc:creator>emma.cronin</dc:creator>
      <dc:date>2015-12-16T12:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953733#M106815</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created now 3D-Solids between attributes ABSHMIN and ABSHMAX, I hope that is what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/206975i361104DF577AE03F/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="2015-12-16 13-13-41.png" title="2015-12-16 13-13-41.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code (VBA, so maybe installing the VBA Enabler for AutoCAD is required) which does this (only done for exact this drawing structure) can be found here:&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;LI-SPOILER&gt;&lt;BR /&gt;
&lt;PRE&gt;Option Explicit

Public Sub ExtToAttHeight()
   Dim tEnt As AcadEntity
   For Each tEnt In ThisDrawing.ModelSpace
      If TypeOf tEnt Is AcadBlockReference Then
         Call handleBlockRef(tEnt)
      End If
   Next
End Sub

Private Sub handleBlockRef(ByRef BlRef As AcadBlockReference)
   If BlRef.HasAttributes Then
      Dim tH1 As Double: tH1 = -1
      Dim tH2 As Double: tH2 = -1
      Dim tAtts As Variant: tAtts = BlRef.GetAttributes
      Dim i As Integer
      For i = LBound(tAtts) To UBound(tAtts)
         Select Case UCase(tAtts(i).TagString)
            Case "ABSHMIN": tH1 = Val(tAtts(i).TextString)
            Case "ABSHMAX": tH2 = Val(tAtts(i).TextString)
         End Select
         If (tH1 &amp;gt;= 0) And (tH2 &amp;gt;= 0) Then Exit For
      Next
      If (tH1 &amp;gt;= 0) And (tH2 &amp;gt;= 0) Then
         'ok, there exits valid data
         Dim tBlDef As AcadBlock: Set tBlDef = ThisDrawing.Blocks(BlRef.Name)
         Dim tEnt As AcadEntity
         For Each tEnt In tBlDef
            'search polyline within the blockdefinition
            If (TypeOf tEnt Is AcadPolyline) Or (TypeOf tEnt Is AcadLWPolyline) Then
               Dim tCurves(0) As AcadEntity: Set tCurves(0) = tEnt
               Dim tRegion As AcadRegion: Set tRegion = tBlDef.AddRegion(tCurves)(0)
               'create solid and move it to base-elevation
               Dim tSolid As Acad3DSolid: Set tSolid = tBlDef.AddExtrudedSolid(tRegion, tH2 - tH1, 0#)
               Dim tPnt1(0 To 2) As Double
               Dim tPnt2(0 To 2) As Double: tPnt2(2) = tH1
               Call tSolid.Move(tPnt1, tPnt2)
               tRegion.Delete
               'Exit For
            End If
         Next
      End If
   Else
      'nothing to do
   End If
End Sub
&lt;/PRE&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;/LI-SPOILER&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;The finished drawing can be downloaded from &lt;A href="http://www.hollaus.at/weblinksend/WebLinkSend.asmx/Download?ID=cb80f980-1aee-47f0-ae9e-32c80ca2d734" target="_self"&gt;&amp;gt;&amp;gt;&amp;gt;here&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;There is one object extruded down to Z=0 .. because there the attribues are not filled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 12:19:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5953733#M106815</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2015-12-16T12:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD - Creating 3D from 2D polygons height attribute?</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5954419#M106872</link>
      <description>&lt;P&gt;That's fantastic; thank you! I'm nowhere near competent enough to understand the entireity of the code but I'll add the VBA enabler. Oddly enough I was thinking I'd be going from zero to RelHMax but the difference between AbsHMin &amp;amp; Max is RelHMax so it's absolutely perfect!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only issue is that the download link is 404ing at the moment! I'll try doing it myself though &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@38DF24EF580240D512020314976B5FC8/emoticons/1f642.png" alt=":cara_con_una_leve_sonrisa:" title=":cara_con_una_leve_sonrisa:" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 17:14:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/autocad-creating-3d-from-2d-polygons-height-attribute/m-p/5954419#M106872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-16T17:14:02Z</dc:date>
    </item>
  </channel>
</rss>

