<?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>topic Re: Section Properties Program in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331515#M18211</link>
    <description>hmm bizarrre

Message was edited by: cadger</description>
    <pubDate>Fri, 29 Aug 2008 22:57:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-08-29T22:57:15Z</dc:date>
    <item>
      <title>Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331507#M18203</link>
      <description>I spend a lot of time making drawings of custom section profiles for engineers. These drawings are usually an HSS or W beam shape with a plate welded on it.&lt;BR /&gt;
&lt;BR /&gt;
I would like to automate the process with VBA, but it's been a while since I've done any programming. &lt;BR /&gt;
&lt;BR /&gt;
I would like to know if the following procedures are something that can be easily done using VBA. I have enough experience that I feel comfortable doing this, I just don't want to get started and find out one of the things I thought could be accomplished can't be.&lt;BR /&gt;
&lt;BR /&gt;
Creating Custom Section Properties Print-Outs&lt;BR /&gt;
&lt;BR /&gt;
- User will create closed section profile of desired shape.&lt;BR /&gt;
- User will run VBA program.&lt;BR /&gt;
&lt;BR /&gt;
Functions&lt;BR /&gt;
&lt;BR /&gt;
- Region all elements.&lt;BR /&gt;
- If two or more regions are the result it will perform the ‘Subtract’ command.&lt;BR /&gt;
- The first selection will select the largest region based on area.&lt;BR /&gt;
- The second selection will select remaining regions.&lt;BR /&gt;
- Retrieve centriod information of resulting region and move to origin. &lt;BR /&gt;
- Select and copy the information from the ‘massprop’ command.&lt;BR /&gt;
- Create text box on top left corner of Paper Space, paste massprop info.&lt;BR /&gt;
- Make existing viewport in Paper Space zoom to extents.&lt;BR /&gt;
- Possibly place C.O.G. block on origin. (not necessary)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any example code would also be apprieciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Wed, 27 Aug 2008 20:15:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331507#M18203</guid>
      <dc:creator>andrewdroth</dc:creator>
      <dc:date>2008-08-27T20:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331508#M18204</link>
      <description>If you've looked around, you won't see much in the way of code for sections.  At least for me, it was so much work that I shelved it.&lt;BR /&gt;
&lt;BR /&gt;
The problem(s) I ran into were as follows:&lt;BR /&gt;
&lt;BR /&gt;
Using the "section" command, there is no way to tell if you have geometry that is both in front of, and behind, other geometry, at the same time - for example, an iso viewof a  1" long bolt running thru a 1/4" plate. One side of that bolt will be erased, where both sides of the bolt should show, one side being partially hidden.&lt;BR /&gt;
&lt;BR /&gt;
There is no access to the solids to infer your own hidden face determination routines, you dont know where in 3d space your 2d region  used to refer to.&lt;BR /&gt;
&lt;BR /&gt;
The "section plane" command is basically useless, at least in my experience- while it will return valid geometry on curved, angled, and hidden faces, the VBA version only works on one solid at a time, while the user interface version lets you select multiple solids for true hidden faces. if you have more than one solid,  you can end back up at the same issue I mentioned first.&lt;BR /&gt;
&lt;BR /&gt;
Maybe if your application is always used under very limited conditions, you will never run into the problems I saw, however, i've found that using the words "always" and "never", when it comes to coding, eventually get you into trouble.&lt;BR /&gt;
&lt;BR /&gt;
If you are wanting only an orthagonal section, of a solid, that doesnt have to deal with hidden line removal, arent you already doing that very thing by just having the users draw closed 2d shapes? cant the same be accomplished with a trim command on closed polylines?&lt;BR /&gt;
&lt;BR /&gt;
What you're looking to do sounds like a major undertaking, to me. I would stick with using sections/regions, stay away from  using section planes, and from the outset, evaluate the worst case conditions you'll be looking into. Nothing like having 6 months of work go down the tubes one week after your company introduces a new product that has tapers, or fillets, etc, etc...</description>
      <pubDate>Thu, 28 Aug 2008 10:10:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331508#M18204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-28T10:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331509#M18205</link>
      <description>I'm talking about 2D geometry only.&lt;BR /&gt;
&lt;BR /&gt;
The user will create a section of the member in question manually (with lines, arcs, steel shapes, ect.) then run the program. The program just need to turn those lines into a region were massprops can be calculated and fed into a drawing for printing.&lt;BR /&gt;
&lt;BR /&gt;
I think we are talking about two different scenarios.</description>
      <pubDate>Thu, 28 Aug 2008 13:44:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331509#M18205</guid>
      <dc:creator>andrewdroth</dc:creator>
      <dc:date>2008-08-28T13:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331510#M18206</link>
      <description>this sounds quite possible with vba, do you have a sample drawing you'd like to post?</description>
      <pubDate>Fri, 29 Aug 2008 00:33:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331510#M18206</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-29T00:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331511#M18207</link>
      <description>This is a good example of what I would commonly be using this for. Finding the massprops of a steel w beam with a plate welded on the side.</description>
      <pubDate>Fri, 29 Aug 2008 15:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331511#M18207</guid>
      <dc:creator>andrewdroth</dc:creator>
      <dc:date>2008-08-29T15:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331512#M18208</link>
      <description>i failed to mention that i use 2004 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; can anyone export as 2004 and post it?&lt;BR /&gt;
&lt;BR /&gt;
tx</description>
      <pubDate>Fri, 29 Aug 2008 22:14:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331512#M18208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-29T22:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331513#M18209</link>
      <description>Sorry about that</description>
      <pubDate>Fri, 29 Aug 2008 22:23:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331513#M18209</guid>
      <dc:creator>andrewdroth</dc:creator>
      <dc:date>2008-08-29T22:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331514#M18210</link>
      <description>ok, forgive my ignorance..i use the civil aspect of autocad.  The drawing shows a polyline within a polyline.  The lines in the drawing can be converted into regions and the inner one subtracted out of it.  You had mentioned a massprop (something i'm not familiar with, but a SendCommand could take care of that).  How should the 2d be converted in 3d?</description>
      <pubDate>Fri, 29 Aug 2008 22:45:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331514#M18210</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-29T22:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331515#M18211</link>
      <description>hmm bizarrre

Message was edited by: cadger</description>
      <pubDate>Fri, 29 Aug 2008 22:57:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331515#M18211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-29T22:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331516#M18212</link>
      <description>The information returned by the MassProp command is available to VBA directly through the appropriate property, i.e., objRegion.Centroid, objRegion.PrincipalMoments, objRegion.ProductOfInertia, etc.</description>
      <pubDate>Sat, 30 Aug 2008 07:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331516#M18212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-30T07:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Section Properties Program</title>
      <link>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331517#M18213</link>
      <description>ah didn't know that, thanks&lt;BR /&gt;
&lt;BR /&gt;
i took an easy way out and converted the lines into polylines first.  maybe the following could help you get started&lt;BR /&gt;
&lt;BR /&gt;
Sub sample()&lt;BR /&gt;
Dim sset As AcadSelectionSet&lt;BR /&gt;
Dim myLargeRegion As Variant&lt;BR /&gt;
Dim mySmallRegion As Variant&lt;BR /&gt;
Dim myLargeRegionParts(0) As AcadEntity&lt;BR /&gt;
Dim mySmallRegionParts(0) As AcadEntity&lt;BR /&gt;
Dim myRegion As AcadRegion&lt;BR /&gt;
Dim myMText As AcadMText&lt;BR /&gt;
AppActivate Application.Caption&lt;BR /&gt;
ThisDrawing.ActiveSpace = acModelSpace&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
ThisDrawing.SelectionSets.Item("sset").delete&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
Set sset = ThisDrawing.SelectionSets.Add("sset")&lt;BR /&gt;
sset.SelectOnScreen&lt;BR /&gt;
If sset(0).area &amp;gt; sset(1).area Then&lt;BR /&gt;
    Set myLargeRegionParts(0) = sset(0)&lt;BR /&gt;
    Set mySmallRegionParts(0) = sset(1)&lt;BR /&gt;
Else&lt;BR /&gt;
    Set myLargeRegionParts(0) = sset(1)&lt;BR /&gt;
    Set mySmallRegionParts(0) = sset(0)&lt;BR /&gt;
End If&lt;BR /&gt;
myLargeRegion = ThisDrawing.ModelSpace.AddRegion(myLargeRegionParts)&lt;BR /&gt;
mySmallRegion = ThisDrawing.ModelSpace.AddRegion(mySmallRegionParts)&lt;BR /&gt;
myLargeRegion(0).Boolean acSubtraction, mySmallRegion(0)&lt;BR /&gt;
''''''''&lt;BR /&gt;
ThisDrawing.SelectionSets.Item("sset").delete&lt;BR /&gt;
Set sset = ThisDrawing.SelectionSets.Add("sset")&lt;BR /&gt;
sset.Select acSelectionSetLast&lt;BR /&gt;
&lt;BR /&gt;
'from the help file&lt;BR /&gt;
Dim ucsObj As AcadUCS&lt;BR /&gt;
Dim currUCS As AcadUCS&lt;BR /&gt;
&lt;BR /&gt;
    ' Get the current saved UCS of the active document. If the current UCS is&lt;BR /&gt;
    ' not saved, then add a new UCS to the UserCoordinateSystems collection&lt;BR /&gt;
    If ThisDrawing.GetVariable("UCSNAME") = "" Then&lt;BR /&gt;
        ' Current UCS is not saved so get the data and save it&lt;BR /&gt;
        With ThisDrawing&lt;BR /&gt;
            Set currUCS = .UserCoordinateSystems.Add( _&lt;BR /&gt;
                            .GetVariable("UCSORG"), _&lt;BR /&gt;
                            .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), _&lt;BR /&gt;
                            .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), _&lt;BR /&gt;
                            "OriginalUCS")&lt;BR /&gt;
        End With&lt;BR /&gt;
    Else&lt;BR /&gt;
        Set currUCS = ThisDrawing.ActiveUCS  'current UCS is saved&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
Set myRegion = sset(0)&lt;BR /&gt;
Dim Centroid3dPt(0 To 2) As Double&lt;BR /&gt;
Centroid3dPt(0) = myRegion.Centroid(0)&lt;BR /&gt;
Centroid3dPt(1) = myRegion.Centroid(1)&lt;BR /&gt;
Centroid3dPt(2) = 0&lt;BR /&gt;
&lt;BR /&gt;
myRegion.Move Centroid3dPt, currUCS.origin&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.ActiveSpace = acPaperSpace&lt;BR /&gt;
&lt;BR /&gt;
Dim textInsPt(0 To 2) As Double&lt;BR /&gt;
textInsPt(0) = 0&lt;BR /&gt;
textInsPt(1) = 9.66&lt;BR /&gt;
textInsPt(2) = 0&lt;BR /&gt;
Set myMText = ThisDrawing.PaperSpace.AddMText(textInsPt, 5, "Moment of Inertia   X: " &amp;amp; myRegion.MomentOfInertia(0) &amp;amp; vbcr_)&lt;BR /&gt;
&lt;BR /&gt;
' etc for other properties and formatting&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.SelectionSets.Item("sset").delete&lt;BR /&gt;
End Sub</description>
      <pubDate>Sat, 30 Aug 2008 18:00:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/section-properties-program/m-p/2331517#M18213</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-30T18:00:06Z</dc:date>
    </item>
  </channel>
</rss>

