<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>如何实现PS中物体的剪切？</title><link>https://communities.bentley.com/communities/other_communities/chinafirst/w/chinawiki/38226/ps</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>如何实现PS中物体的剪切？</title><link>https://communities.bentley.com/communities/other_communities/chinafirst/w/chinawiki/38226/ps</link><pubDate>Mon, 16 Apr 2018 06:30:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9ea71b34-1ab5-4527-8311-30883bc68e4c</guid><dc:creator>Yongan.Fu</dc:creator><comments>https://communities.bentley.com/communities/other_communities/chinafirst/w/chinawiki/38226/ps#comments</comments><description>Current Revision posted to 技术资料库 by Yongan.Fu on 4/16/2018 6:30:53 AM&lt;br /&gt;
&lt;p&gt;PS编程模型中有PsCutObjects类可以实现该目地。除了调用SetObjectId方法设置第一个物体，SetAsBooleanCut设置第二个物体外，关键的一步是要调用SetSubBodyTpye将类型设置为SubBodyType.kCoomenBody。&lt;/p&gt;
&lt;p&gt;样例代码如下（VB.NET代码，可容易地改为C#）：&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;Shared Sub Example_BooleanCut()

       &amp;#39; 第一个物体被剪切，第二个物体是剪切体

        Dim FirstShapeId As Long
        Dim SecondShapeId As Long
        Dim ksCutObjects As New PsCutObjects
        Dim Selection As New PsSelection

        FirstShapeId = Selection.PickObject(&amp;quot;Select first object: &amp;quot;)

        If FirstShapeId &amp;lt;&amp;gt; 0 Then

            SecondShapeId = Selection.PickObject(&amp;quot;Select second object: &amp;quot;)

            If SecondShapeId &amp;lt;&amp;gt; 0 Then

                ksCutObjects.SetObjectId(FirstShapeId)
                ksCutObjects.SetAsBooleanCut(SecondShapeId)
                ksCutObjects.SetSubBodyType(SubBodyType.kCommenBody)
                ksCutObjects.Apply()
            End If
        End If
    End Sub
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>如何实现PS中物体的剪切？</title><link>https://communities.bentley.com/communities/other_communities/chinafirst/w/chinawiki/38226/ps/revision/1</link><pubDate>Mon, 16 Apr 2018 06:01:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9ea71b34-1ab5-4527-8311-30883bc68e4c</guid><dc:creator>Yongan.Fu</dc:creator><comments>https://communities.bentley.com/communities/other_communities/chinafirst/w/chinawiki/38226/ps#comments</comments><description>Revision 1 posted to 技术资料库 by Yongan.Fu on 4/16/2018 6:01:38 AM&lt;br /&gt;
&lt;p&gt;PS中有PsCutObjects对象可以实现该目地。除了调用SetObjectId方法设置第一个物体，SetAsBooleanCut设置第二个物体外，关键的一步是要调用SetSubBodyTpye将类型设置为SubBodyType.kCoomenBody。&lt;/p&gt;
&lt;p&gt;样例代码如下（VB.NET代码，可容易地改为C#）：&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;Shared Sub Example_BooleanCut()

       &amp;#39; 第一个物体被剪切，第二个物体是剪切体

        Dim FirstShapeId As Long
        Dim SecondShapeId As Long
        Dim ksCutObjects As New PsCutObjects
        Dim Selection As New PsSelection

        FirstShapeId = Selection.PickObject(&amp;quot;Select first object: &amp;quot;)

        If FirstShapeId &amp;lt;&amp;gt; 0 Then

            SecondShapeId = Selection.PickObject(&amp;quot;Select second object: &amp;quot;)

            If SecondShapeId &amp;lt;&amp;gt; 0 Then

                ksCutObjects.SetObjectId(FirstShapeId)
                ksCutObjects.SetAsBooleanCut(SecondShapeId)
                ksCutObjects.SetSubBodyType(SubBodyType.kCommenBody)
                ksCutObjects.Apply()
            End If
        End If
    End Sub
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>