Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Generate code and Build multiple components in one shot
Topic Summary:
Created On: 7-Feb-2007 14:53
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 7-Feb-2007 14:53
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

I would like to know if there is a way to automate the generating code and building multiple components efforts in Rhapsody 6.1. It is rather time consuming when you have to manually generate code and build a component at a time when you have multiple of them. Perhaps VBA would be the way to go?

Any help is greatly appreciated.

KN

PS: I have searched the forum but couldn't find anything associate with this topic.
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 15:41
User is offline View Users Profile Print this message


Garreth Cregg

Posts: 1
Joined: 27-Jul-2005

I have a similar requirement at the moment and the method I'm looking at is calling rhapsody with a script to carry out a sequence of builds - check out the idea in
the C:\Rhapsody\Samples\CppSamples\Command Line Interface
Hope this is of some help
Cheers,
Garreth.
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 16:03
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Garreth,
Thanks for the info. I will look into it. If I have further question, I will be back.

Kevin
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 18:29
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Garreth,
I found the file, modified it to run on the Dishwasher example. How do I run the script?

Thanks,
Kevin
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 18:57
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Garreth,
I found the way to kick off the script. Here is the next question. The script only "generate EXE" an active component. It doesn't traverse the component lists to execute on other components. Is there a way to use the script to "generate EXE" on a set of specified components?

Thanks,
Kevin
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 20:02
User is offline View Users Profile Print this message


Jesper Gissel

Posts: 88
Joined: 20-Jul-2005

Hi guys

I don't know if this is usefull, but we use a VBA macro to generate/build our exe component and all the lib components that it depends on.

Let me know if it is of any interest. (If it does, I might need some time to beautify the code :rolleyes: )

Regards

-------------------------
Jesper Gissel
Johnson Controls Denmark, Marine Controls
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 20:25
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

jegissel,
I believe this is exactly what I need. I searched for "script" and found Simon posted a script to generate code for every single component in a project:

Public Sub generateAllConfigurations()
'Get current project
Dim rpy As RPProject
Set rpy = getProject

'Save the current active component/configuration
Dim cmpSaved As RPComponent
Dim cfgSaved As RPConfiguration
Set cmpSaved = rpy.activeComponent
Set cfgSaved = rpy.activeConfiguration

'Iterate through each configuration in the project
Dim cfg As RPConfiguration
Dim elt As RPModelElement
For Each elt In rpy.getNestedElementsRecursive
If TypeOf elt Is RPConfiguration Then
Set cfg = elt
rpy.setActiveComponent elt.owner.name
rpy.setActiveConfiguration elt.name
generate
End If
Next

'Restore the active component/configuration
rpy.setActiveComponent cmpSaved.name
rpy.setActiveConfiguration cfgSaved.name
End Sub

I also be able to modify the above script so that I can pick exactly which component I want to code gen for base on the components' names.

I am looking for the second part, building the components. It would be great if I can have script which allows me to build all components or a number of selective components.

Your help is appreciated.
Kevin
Report this to a Moderator Report this to a Moderator
 7-Feb-2007 22:08
User is offline View Users Profile Print this message


Jesper Gissel

Posts: 88
Joined: 20-Jul-2005

Hi Kevin,

I've attached the VBA files we use in our projects for building the exe and the dependent libs.

I'll leave it up to You to figure it out, but please let me know if you need any help.

By the way, if you find a way to avoid the "Wait for build to finish!" message boxes, I would very much like to know!

Regards

-------------------------
Jesper Gissel
Johnson Controls Denmark, Marine Controls
Report this to a Moderator Report this to a Moderator
 9-Feb-2007 16:28
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Jesper,
Thanks for the script. I will let you know if I find a way around "Wait for build to finish".

Kevin
Report this to a Moderator Report this to a Moderator
 9-Feb-2007 17:33
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Jesper,
I play around with your VBA a little bit and look like we have to have a script to generate code for all the components and then run your script to build the components?

Is my thinking wrong? Do you have instructions on how to use your script?

Thanks,
Kevin
Report this to a Moderator Report this to a Moderator
 9-Feb-2007 20:51
User is offline View Users Profile Print this message


Jesper Gissel

Posts: 88
Joined: 20-Jul-2005

Hi Kevin,

To start from the beginning, you have to do the following:

1. Import the modBuild.bas and frmBuild.frm files into your project.

2. Add a VBA helper with the following parameters:
- Name: Build Component (or what you might prefer)
- Module: modBuild
- Macro name: build
- Applicable To: Configuration

The way you use the script, is that you right-click the configuration of the component that you wish to build, and then click "Build Component". This invokes a GUI that shows you a list of the components that will be build.

When you click OK, a number of "Wait for build to finish" message boxes will appear. These are shown for the same reason that Simon Morrish mentions in the "Multi component dependencies compiler " thread. It is far from elegant, so any suggestions are wellcome.

Please let me know of your experience!

Regards

-------------------------
Jesper Gissel
Johnson Controls Denmark, Marine Controls
Report this to a Moderator Report this to a Moderator
 12-Feb-2007 13:53
User is offline View Users Profile Print this message


Kevin Nguyen

Posts: 14
Joined: 13-Dec-2006

Jesper,
I will test the idea out later and let you know.

Thanks,
Kevin
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.