OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 14-02-2017, 05:53
WernerHo WernerHo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 20
Default shapes catch nodes by VBA

Hello
I hope my english will be good enough to explain, what I would like to do...

I have a VBA Macro that takes some Shapes out of the Clipboard, ungroups them, changes the outlinewidth, applys 'nofill' after pasting it into Coreldraw.
The Problem is, that after changing the outlinewidth these Shapes don't fit together anymore, there are various, different Gaps between them.

If I take a Corner-Node with the Mouse and put them together with the near by Shapes-Corner-Node the Shapes where catched together.

Because the Gaps and the Sizes of the Shapes are different it is not posible to move the shapes with a fixed Value.

Is there any possibility to move the shapes to 'node on node' by VBA?

Would be realy nice if anybody has any tipps for me.
Regards
Werner

Last edited by WernerHo; 14-02-2017 at 06:01.
Reply With Quote
  #2  
Old 17-02-2017, 11:46
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Nodes Example

If you could post an example .cdr file it would be helpful. A before and after example workds best.

-Shelby
Reply With Quote
  #3  
Old 28-02-2017, 11:28
WernerHo WernerHo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 20
Default

Hi Shelby
thank you for your Post. I read it a little late, so my answer comes late...
I attached a .cdr with an example.
Hope is's possible to understand, what I'm trying to do.
If you have any Ideas it would be great!
Werner
Attached Files
File Type: cdr nodescatching1.cdr (73.0 KB, 73 views)
Reply With Quote
  #4  
Old 02-03-2017, 01:28
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

I think that it would be better refuse from copy/paste operations via the clipboard.
Reply With Quote
  #5  
Old 02-03-2017, 05:09
WernerHo WernerHo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 20
Default

Hi Shark
may be that it would be better, but these Shapes are created in Excel, because there is the Main-Makro-Construct, wich does a lot of the Work I need.
And when these Shapes are created I see no other solution except Copy/Paste..
Reply With Quote
  #6  
Old 06-03-2017, 08:06
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

I have macro that arranges shapes to each other end to end (without gaps) but you have a text-shapes which must be grouped with rectangles. And then all this shapes will be "organized"
Reply With Quote
  #7  
Old 09-03-2017, 11:14
WernerHo WernerHo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 20
Default

Hi Shark
thank you for your intensiv afford!
I will see, if I can change my Macro to Group these Shapes (Text with Rectangles) but I see a Problem there:
My Macro ungroups the Shapes, that came out of the Clipboard from Excel, because I have to change the Linethickness to hairline (unfortunately Excel can't produce Hairlines and I need them to work with).
I have to try to ungroup the Textshapes, then change the Linethickness and then to group them again. After this it would be very helpfull to see your Macro to arrange them end to end, without a Gap.
I will post again, if this 'work is done'.
Reply With Quote
  #8  
Old 10-03-2017, 07:08
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

Hi
By the way, you can do it without Ugroup/Group-actions. If you pasting from clipboard all this shapes and they are already grouped then you can change rectangle's thickness directly from Group-shape. If your group-shapes consists of two shapes - rectangle and text - then you can write this:

'For example, s = one of pasted shapes
s.Shapes.FindShape(, cdrRectangleShape).Outline.Width = 0.01 ' change thickness of the rectangle found inside the group to 0.01 /mm or pixels or any measure unit/
If your rectangle is curved rectangle then change cdrRectangleShape to cdrCurveShape

Last edited by shark; 10-03-2017 at 07:11.
Reply With Quote
  #9  
Old 11-03-2017, 06:54
WernerHo WernerHo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 20
Default

Hello Shark
this sounds like a very, very good Idea, because it would make my Code much more effectiv.
But
I don't realy understand where in my Code this new Part could be placed.
Even it may be a problem that that, what I paste is a Group of up to 40 Shapes within Text. I dont' know if VBA finds the rectangelshapes in a group of many shapes with each has text in it.

My Code ist:
Code:
Option Explicit
Sub Thor_o_Mat()
Dim shp As Shape, SB As Double, SH As Double
Dim OrigSelection As ShapeRange
Dim PY As Double, PX As Double
ActiveDocument.BeginCommandGroup "Schilder"
Optimization = True
EventsEnabled = False
ActiveDocument.SaveSettings
ActiveDocument.PreserveSelection = False
ActiveLayer.Paste
   Set OrigSelection = ActiveSelectionRange
'   ActiveSelection.Ungroup
For Each shp In ActivePage.Shapes

'*******************************
shp.Shapes.FindShape(, cdrRectangleShape).Outline.Width = 0.003
'*************************   Would this be the right place????

If shp.Type = 3 Then
SB = Round((shp.SizeWidth * 2.54), 0)
SH = Round((shp.SizeHeight * 2.54), 0)
SB = SB / 2.54 + 0.005
SH = SH / 2.54 + 0.005
shp.Fill.ApplyNoFill
'PX = shp.PositionX
'PY = shp.PositionY
   With shp
        .SizeHeight = SH
        .SizeWidth = SB
'        .PositionX = PX - 0.02
'        .PositionY = PY + 0.02
        .Outline.Type = cdrOutline
        .Outline.Width = 0.003
        .Outline.Color.RGBAssign 255, 0, 0
    End With
End If
Next shp
ActiveDocument.PreserveSelection = True
ActiveDocument.RestoreSettings
EventsEnabled = True
Optimization = False
ActiveDocument.EndCommandGroup
ActiveWindow.Refresh
Application.Refresh
End Sub
But in the "For each shp..." Part I get en Error...
(The following Code is, what I used to change Linethickness)
Sorry but my VBA isn't very advanced.
Can you help again?

Last edited by WernerHo; 11-03-2017 at 07:30.
Reply With Quote
  #10  
Old 13-03-2017, 04:49
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

Hi, WernerHo
Could you upload work .xls-file with some shapes and text, that you then copyng to clipboard and paste to CorelDraw?

I will try to improve your code
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop thru shapes and break at nodes nic CorelDRAW/Corel DESIGNER VBA 5 13-03-2016 05:58
Nodes Val Costanzo General 4 25-09-2008 05:46
VBA Nodes Tutorial Sablesword CorelDRAW/Corel DESIGNER VBA 1 23-09-2008 21:01
How can I catch the OnClose event? Elie CorelDRAW CS 2 01-04-2004 00:20
Too many nodes ddonnahoe CorelDRAW/Corel DESIGNER VBA 3 27-02-2004 07:14


All times are GMT -5. The time now is 17:40.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com