I'm tearing my hair out trying to work with generatedpoints in draft view. I have a 3D model with points that are named in a particular way, per the picture below:
point names
Then on the CATDrawing, I have generated views that show those points. if I click those points in 2D, they are named in the following manner, "GeneratedPoint (insert 3D point name here)". You can see this naming example below:
2D generated naming
Now, what I'm trying to do in VBA is run a code that will select those generated points in a view, duplicate geometry on them, and name that duplicated geometry to match the 3D point names. My problem is, I can't seem to access the "GeneratedPoint" names that show up when I click the points in 2D. Below is a snippet of my code where I'm trying to access the name of the selected points:
For j = 1 To totalcnt
Set bSel = aDoc.Selection
bSel.Add ActiveView
bSel.Search "Name='*GeneratedPoint *',sel"
Set nm = bSel.Item(j)
desc = nm.Name
desc = nm.Value.Name
Usually when I have a selection, and I make an object from one of those selections, I can access the name through selection.Item(j).Name or selection.Item(j).Value.Name, but in this case neither one works.
at the desc=nm.Name line above, it gives me a name of "CATIASelectedElement16", not the actual name I see in the status bar when I click it in the drawing. And when I use desc=nm.Value.Name it gives me "Front View", which is the name of the view these points are in. I know it's selecting the points correctly, I can see them get selected, and I can see the count on the selection object matches my number of points. What am I missing? For reference, when I run the line Set nm=bSel.Item(i), that object looks like this in the Locals window.
Object in Locals window
As you can see in that picture, the object Type is DrawingView, whereas I would expect it to be a point. Does anyone have any ideas on how to access the name of a generated item in 2D? So far the only way I can interact with it at all is by using selection.Search, which will find them by name, but I have no way of then actually using the specific names of those points it found. Any insight would be appreciated!
Related
I created a graph that looks alright to me with the following line of code:
df_wide.plot.area(xticks=df_wide.index, legend=False, xlabel= 'Week', ylabel='Percent', title='Percentage of Letters')
However I would like to add the name of selected (or all) dataseries to the right side of the Graph, so that it attaches little lines to the right side and the column name appears next to it, I attach a picture with my current output and how I want it to look (not exactly well edited, but I am sure you get the idea)...
Maybe somebody can helb me :) Thank you!
I have two shapes, masterShape on the page Data and slaveShape on the page ESB. I mention that the Name & NameU of my pages are the same. I already read a lot about this (See here for example).
My goal is to make the text of slaveText equal to this of masterText.
I read a lot about referencing pages and fields, but seemingly not enough.
I start with the two shapes on the same page. When the two shapes are on the same page, I can assign a field to the slaveShape with this custom formula =SHAPETEXT(masterShape!TheText) so that it gives the expected result. Yes.
How to access this shape with a page reference?
I tried this:
=SHAPETEXT(ThePage!Softwares!TheText) -> Error in formula (and should not meet the requirements)
=SHAPETEXT(Pages[Data]!Softwares!TheText) -> Bad ShapeSheet Name
Yet this code in VBA gives the expected text:
Debug.Print ActiveDocument.Pages("Data").Shapes("Softwares").Text
Any idea to convert this VBA into a formula using =SHAPETEXT(...)?
Please use syntax with ID instead shape name. This syntax looks like
=SHAPETEXT(Pages[Data]!Sheet.740!TheText)
But you must find ID of master shape.
Using MS access I need to open a word document and change certain images within the header. Whilst I have the code to find and replace any text that I need, I do not quite understand how to replace an image keeping it to a specific width and height.
The header within the Word document is constructed using a basic table with 3 columns as depicted below. The image in the right hand column will need to change for a specific logo.
I have managed so far to add an image to the document using the following code which gives the expected result...
With WordDoc.StoryRanges(wdPrimaryHeaderStory)
.InlineShapes.AddPicture FileName:="test.jpg"
End With
I understand that this is due to me not specifying a specific location, size etc but I am struggling to find resources which would instead allow me to either remove and add a new image to the right column or just swap the images out.
EDIT 1:
Link to code
I am attempting to move 5, individual pictures (as defined at the beginning of the code) and manipulate each picture in a different way. Each function that is used to manipulate a picture has a pretty obvious name for what is going to happen to that picture
I am using Jes to code this in Jython.
My problem is that even though I clearly specify where on my final canvas that I want these pictures to go to, they for some reason all default to (0, 0). So basically, the only picture that will be displayed is whichever the last one is that is called on. If you were to comment out the last picture, which in the code is the fifth (the "lighten" one), the fourth picture would be the one that got displayed instead so this proves that the pictures are all defaulting to (0, 0). The pictures do not go to their designated spots and that is what I am having trouble with.
***Side note: the functions "greyScale", "colorAvg", "colorSwap", and "lighten" should have nothing to do with the problem. I also don't think my "copy" function should be a problem either but I could be wrong.
I changed my copy function so that the parameters are (picture, destination, targX, targY)
Then in the copy function I made it:
targetX = targX
and then later
targetY = targY
This is code from Excel 2010. All of the code resides within the workbook itself. Information is gathered using internal forms and the code is run.
I have code that retrieves data from a spreadsheet and populates an object with that data. The row number is dynamic as it is dependent on the form input. The column is by the header, not the column number. The following code works perfectly but for two anomalies:
cTank.RowForTankSpecs = rNum
cTank.MP = .Cells(rNum, Range("MP").Column).Value
cTank.Form = .Cells(rNum, Range("formName").Column).Value
cTank.TankProcess = .Cells(rNum, Range("Process").Column).Value
cTank.Location = .Cells(rNum, Range("Location").Column).Value
cTank.TankName = .Cells(rNum, Range("Tanks").Column).Value
cTank.tankID = .Cells(rNum, Range("TankID").Column).Value
First:
The cTank.TankName is retrieving information from a column named "Tanks". That column does not exist. The actual column header is "Tank". But, it is retrieving the correct information. If I change the name to what it really is (Tank), it does not work.
Second:
When the cTank.TankID line is executed, I get the following error on the Range("TankID"):
Runtime Error 1004: Method 'Range' of object '_Global' failed
This one has the appropriate header (column header), but it is not recognizing the range.
I have tried simple things such as changing the order of the code, but it doesn't help. As earlier stated, the other lines work. Later in the program, information is gathered in the same manner but using another worksheet from the same workbook, and none of them are working. I've double checked that strings are strings and integers are integers, etc. I've double checked the column headers match the range names. Nothing seems to jump out at me.
I would appreciate any input you may have on the situation.
Thanks in advance.
Steve
Ok. Being pretty sure my code was correct, I went to the spreadsheet itself. For some reason it was recognizing only certain columns and it was recognizing one of them incorrectly. So I started highlighting the columns that worked and also the columns that didn't. What I noticed was that on the columns that were being recognized, that column header was displayed where the cell location is normally displayed whereas on the columns that were not being recognized, the cell location (i.e. A1, A2, etc.) for the header was being displayed and not the header title itself. The incorrect label was showing up for one of them. As it turns out, the mislabeled column was one that I had used for a form dropdown menu. So, I checked the name manager, and the ones that were working were listed. So anyway, using the name manager, I added named ranges using the headers. Now, when I select the columns, the column header(named range) appears in that window and now, the code works.
Thanks guys for your input. I really appreciate it.
Two things you can do:
Do not use use Range, but as it seems you are using names, use Names("Yourname").Referstorange.
OR
Make sure your names are set up correctly using the Name Manager in Data Ribbon.